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: Logical Cell
Replies: 2   Last Post: Nov 30, 2012 2:55 AM

Advanced Search

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

Posts: 7,872
Registered: 6/7/07
Re: Logical Cell
Posted: Nov 29, 2012 1:33 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 11/29/2012 11:20 AM, Mathew Thomas wrote:
> Hello,
>
> I have a 1 X 5 cell, with logical values:
>
> out{1,1} = [1,0];
> out{1,2} = [0,0];
> out{1,3} = [0,0,1];
> out{4} = 0;
> out{5} = [0,1];
>
> How do I get the location of all the ones ?
>
> Something like (1,1), (3,3), (5,2)


Best I can suggest is you can do

find([out{:}])

and get the locations of the nonzero values in the linear vector. Then
you can do length() on each cell and divide the cell lengths
successively into the vector to get the cell index.



Date Subject Author
11/29/12
Read Logical Cell
Mathew Thomas
11/29/12
Read Re: Logical Cell
dpb
11/30/12
Read Re: Logical Cell
Bruno Luong

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.