Date: Aug 26, 2013 3:14 PM
Author: dpb
Subject: Re: deleting rows from 3-D arrays
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 2-D array will have the same length. I can do this one

> 2-D 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 zero-rows 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 differently-sized 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 differently-sized objects.

--