Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Creating Booleans from Vectors
Replies: 5   Last Post: Sep 17, 2013 11:23 PM

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: Creating Booleans from Vectors
Posted: Sep 17, 2013 5:26 PM

On 9/17/2013 3:37 PM, Michael wrote:
...
> x = [1 3 8 10 11];
> y = [2 6 9 15];

...
> xy_ordered = [1 2 3 6 8 9 10 11 15];

which, I presume you recognize can be created as

xy=sort([x y]);

?

> and I want to make a couple 'cuts';
> cX = [1 0 1 0 1 0 1 1 0]
> cY = [0 1 0 1 0 1 0 0 1]; %by definition the is ~cX..
>
> What's the quick way to identify and create these cX and cY from x, y,
> and xy_ordered?

...

No klew. What does cX have to do w/ any of the above other than it is
the same length? I see no correlation of locations of the 1's in cX to
the values of x,y or xy.

If you're looking at logical, then

iX = logical([1 0 1 0 1 0 1 1 0]);
iY = ~iX;

but how to set the particular locations is needing the crystal ball...

--

Date Subject Author
9/17/13 Michael
9/17/13 dpb
9/17/13 Roger Stafford
9/17/13 dpb
9/17/13 Michael
9/17/13 Michael