Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: deleting rows from 3-D arrays
Replies: 2   Last Post: Aug 26, 2013 4:34 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,193
Registered: 6/7/07
Re: deleting rows from 3-D arrays
Posted: Aug 26, 2013 3:14 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.