From: Steven Lord on

"DSPtree" <paulscot45(a)yahoo.com> wrote in message
news:116172535.97656.1273403255814.JavaMail.root(a)gallium.mathforum.org...
> need to display
> 'z' is some random value. its a part of another program.
>
> Now I want to display the result as m1,m2,m3,m4,m5,m6. how would i do it?
> shall i use another for loop? but whats the format then? or else i have to
> go for 6 display commands for each of them...

Are you attempting to _display_ the results like this or are you trying to
create individual variables named m1, m2, etc.? If the latter, DON'T -- see
Q4.6 in the newsgroup FAQ for an explanation why this is discouraged.

If the former, use FPRINTF.

for k = 1:6
fprintf('m%d is %d', k, k.^2)
end

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: DSPtree on
hey .. thank you so much.. it worked. thanks a lot