I would like to run my function and to create 3 different output varables.
for i=1:3
for j=1:3
Rent_nb = landrent(i,j,Dist);
end
end
And I would like "_nb" to be 1, 2, 3... so I get 3 output arrays.
So I looked on the internet and I saw I had to use this :
http://www.mathworks.com/matlabcentral/answers/29712-creating-a-new-variable-in-each-iteration
So that would give me :
for i=1:3
for j=1:3
eval(['rent' num2str(i) '= landrent(i,j,Dist_lowcost)']);
end
end
This seems to work but I don't really understand it... I would like to get 9 outputs (one for each combination of i and j) instead of 3. I guess it has something to do with this part: num2str(i).. But I don't really understand how this works or what it does. Can someone explain/help?
Thanks