1

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

1
  • How date_1, date_2 look like? Are they strings, vectors, matrices? Same size or not? Commented Mar 3, 2013 at 1:20

1 Answer 1

2
 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...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.