How can I create a 3-d matrix from a 2-d matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
zephyr21
am 12 Jun. 2016
Kommentiert: zephyr21
am 13 Jun. 2016
My matrix is an 11x14 matrix and I would like to create 2 more "pages" behind the original of the same values for a total of 3 "pages". Is there an efficient way of doing this? This needs to be done for several matrices.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 13 Jun. 2016
Another way is to use cat(3,...) instead of repmat():
output = cat(3, myMatrix, myMatrix, myMatrix);
or "If I have the A(:,:,2) matrix and want to replicate those values into A(:,:,1) and A(:,:,3),"
A(:,:,1) = A(:,:,2);
A(:,:,3) = A(:,:,2);
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices 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!