how to remove zero matrix(all elements are zeros) from 'distances which is 3d matrix'??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
M.Prasanna kumar
am 28 Aug. 2019
Kommentiert: M.Prasanna kumar
am 28 Aug. 2019
distances = reshape(dist3,[100,250,484]);
in the above "distances" matrix there are 231 matrices in which all the elements are zeros. i want to delete all 231 matrices. so that size of dstances matrix should be 100*250*253
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 28 Aug. 2019
Bearbeitet: madhan ravi
am 28 Aug. 2019
distances(:,:,squeeze(~all(distances,[1,2])))=[]
% if you're using an older version then:
distances(:,:,squeeze(~all(all(distances,2),1)))=[]
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!