Filter löschen
Filter löschen

Join some matrices to one matrix

2 Ansichten (letzte 30 Tage)
Moe
Moe am 3 Nov. 2014
Bearbeitet: per isakson am 3 Nov. 2014
I have a cell array of matrix m{j} % which row numbers are different in each j
How can I bring all of them in one matrix?
For example:
m{1} = [2;3;4;7;1;20];
m{2} = [5];
m{3} = [1;2;70];
So, I need a new matrix like:
new = [2;3;4;7;1;20;5;1;2;70];

Akzeptierte Antwort

Mikhail
Mikhail am 3 Nov. 2014
Bearbeitet: per isakson am 3 Nov. 2014
new=[];
for i=1:n % n - number of cells
new=[new;m{i}(:)]
end
%%% So we take each m{i}, turn it into 1 column calling m{i}(:) and join it to our new column

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by