MATLAB: Matrix manipulation: update columns from stored variables

matrix manipulation

Suppose I have a set of variables (15) as column vectors, called A from 1-15. Now I would like to make a matrix of all those variables. They have 12501 rows if that helps.
I thought about creating first a zeros matrix (12501,15), and then append each column with my variables.
is there other way to do it? I read about cell2mat but I don't get it. I am truly beginner..
How could I do it in a loop for n variables?
Any help will be very appreciated! Thanks

Best Answer

‘I have a set of variables (15) as column vectors, called A from 1-15’
If they are ‘A1’, ‘A2’, ... ‘A15’, and you only need to do this once, just type it manually:
A_Matrix = [A1 A2 A3 A4 A5 ... A15];
I will let you fill in the others.
Then save it as a ‘.mat’ file so you can simply load it when you need it.