Making matrices of different dimensions and clubbing them together
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
shahzer rahman
am 6 Mär. 2020
Kommentiert: Stephen23
am 7 Mär. 2020
I am running a for loop which gives row matrices as the output.
for (i=1), output matrix is a [1*1114] matrix.
for (i=2), output matrix is a [1*1213] matrix
the dimensions of the matrices keep increasing.
my desired final matrix is a matrix that contains all the stored values of all iterations.
Please help.
Error says : Unable to perform assignment because the size of the left side is 1-by-1114 and the size of the right side is 1-by-1213.
I am new to matlab.
0 Kommentare
Akzeptierte Antwort
Stephen23
am 6 Mär. 2020
Bearbeitet: Stephen23
am 6 Mär. 2020
A simple and efficient approach using a cell array:
N = number of loop iterations
C = cell(1,N);
for k = 1:N
... your code
C{k} = [...] % output vector
end
V = [C{:}] % output vectors concatenated into one
See:
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!