I have some algorithm including a while
loop:
while (condition)
% do something and return a result array B
end
Let\'s say:<
You can join your arrays either using horzcat or []. Then initialize an cell and save them into that cell.
%% loop
count = 0 ;
iwant = cell([],1) ;
while .....
count = count+1 ;
%% let be your arrays
B1=1:9 ;
B2=10:15 ;
B3=16:19 ;
B4=20:30 ;
%% join them into array
B = [B1 B2 B3 B4] ;
iwant{count} = B ;
end
You can make use of the end
keyword
% Initialise empty cell array
A = {};
while *condition*
% Create B using some calculation (different each loop)
B = [1 2 3];
% Other code ...
% Assign to array
A{end+1} = B;
end