Deleating the 3rd dimension from a 3Dmatrix
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ram Rapaka
am 2 Mär. 2020
Kommentiert: Ram Rapaka
am 2 Mär. 2020
I am unable to remove the thrird dimension from my matrix containing three dimensional elements. I got 3 idetical matrices so I want to eleminate 2 of them (a(:,:,22),a(:,:,23)).

I tride the above written code

0 Kommentare
Akzeptierte Antwort
the cyclist
am 2 Mär. 2020
Bearbeitet: the cyclist
am 2 Mär. 2020
You can remove both at once:
a(:,:,[22 23]) = [];
The main problem with your method is that after you remove the 22nd slice, the 23rd slice "moves" into the 22nd position, so there is no 23rd slice anymore. At the next iteration of the loop, when you try to remove the 23rd slice, it no longer exists.
Weitere Antworten (0)
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!