Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


dpb
Posts:
9,331
Registered:
6/7/07


Re: deleting rows from 3D arrays
Posted:
Aug 26, 2013 3:14 PM


On 8/26/2013 1:55 PM, Nick wrote: ...
> ... Each of the 20 2_D arrays contains the correct annual data, and all > are the same length, which means each has a different number of terminal > zeros in the last rows. I need to delete all such rows containing zeros. > So not all final 2D array will have the same length. I can do this one > 2D array at a time by replacing zeros with NaN's in each and then > assigning a unique variable name to each and using X(any(isnan(X),2),:) > = []; BUT I cannot succeed in using this command in a for loop to > eliminate the zerorows in one fell swoop. It seems that Matlab should > easily be able to do this. But I can't figure it out.
Overall you can't do it because you can't have a differentlysized plane in a 3D array at various plane levels.
You could do it by turning the result into a cell array; the cells in a cell array can be differentlysized objects.




