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: Removing rows from a cell array
Replies: 1   Last Post: Dec 4, 2012 5:49 AM

Advanced Search

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

Posts: 53
Registered: 11/29/10
Removing rows from a cell array
Posted: Dec 3, 2012 7:02 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,

I am having trouble removing rows from a cell array. I have a much larger cell array, but a portion of it is shown as follows:

ans =
'11' '111213424137S' '6/7/2012 7:50:01 AM' [150.6] [2000.58]
'11' '111213424137S' '6/14/2012 11:14:07 AM' [1407.34] [0]
'11' '111213424141S' '6/7/2012 7:58:06 AM' [-134.45] [134.45]
'11' '111213424141S' '6/14/2012 11:10:08 AM' [200.08] [0]

Now I want to remove the rows where a zero appears in the fifth column of the cell array. In this case I want to remove rows 2 and 4. I have tried using a for loop to accomplish this, but the dimensions of the matrix always change. I have tried using cellfun also,

MasterSAS(any(cellfun(@(x) x(5) == 0, MasterSAS),2), :) = [];

But this clearly does not work. Any clarification or help would be much appreciated. Thanks.

Kevin



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.