a=[1;2;3;4]b=[5;6;7]for i=1:4 for j=1:3x=a(i)+b(j)endend
% it gives 12 x but I cannot merge all x(i) like that:
x=[6;7;8;7;8;9;8;9;10;9;10;11] %[x(1);x(2);x(3);......x(12)]
for loop
a=[1;2;3;4]b=[5;6;7]for i=1:4 for j=1:3x=a(i)+b(j)endend
x=[6;7;8;7;8;9;8;9;10;9;10;11] %[x(1);x(2);x(3);......x(12)]
Best Answer