MATLAB: Assigning some matrices to 1 matrix

MATLABmatricesmatrix

Hi,
I want to assign some matrices to 1 matrix that can be represent 6 matrices.
for example for 3 matrices: f1=[100 0 100]; f2=[500 100 0]; f3=[0 300 300]; f=[? ? ?]
What can I do?????
I got stuck for 2 month, please help.
thanks.

Best Answer

Are all your matrices the same size - i.e. 1-by-3?
If so then
f = [f1; f2; f3;...; fn];
will work to give you an n-by-3 matrix where each row is one of your fn.
Ideally you don't want to have variables named as f1, f2, f3, etc in the first place though so if possible put the data into this single matrix format straight away without the need to combine multiple variables like this.