Reputation: 73
i want to concatenate some data from n files into one matrix after a loop. Now the following codes work, but how can i add all the date_1, date_2,.....,date_n
into date
?
date_1 = cell2mat (data{1,1}{1,1});
date_2 = cell2mat (data{1,2}{1,1});
date = [date_1;date_2];
Thanks. --Jackie
Upvotes: 1
Views: 2150
Reputation: 46435
date = [];
for ii = 1:n
date = [date; cell2mat(data{1,ii}{1,1})];
end
Should work if I understand your data. If it doesn't please say so in the comments.
By the way this is not efficient, especially when n is large; but without knowing more about your data it is hard to write something more efficient...
Upvotes: 2