I have a two column vectors (Vector A and Vector B).
Both are randomly assigned 1 or 0 for each row.
I want to use a vectorized if statement to test if each row of A equals the corresponding row of B and put the output in a corresponding row of Vector C.
ie. column Vector C will end up being something like:
"true"
"false"
"false"
"true"
"happydude Hudson" <hud_wa@hotmail.com> schrieb im Newsbeitrag
news:hd983a$782$1@fred.mathworks.com...
>I have a two column vectors (Vector A and Vector B).
>
> Both are randomly assigned 1 or 0 for each row.
>
> I want to use a vectorized if statement to test if each row of A equals
> the corresponding row of B and put the output in a corresponding row of
> Vector C.
>
> ie. column Vector C will end up being something like:
> "true"
> "false"
> "false"
> "true"
>
> etc
>
> how would I do this?
>
if they are vectors then C should just be
C = (A == B)
Titus
( ) are not necessary, just to make it more readable ...
"Titus Edelhofer" <titus.edelhofer@mathworks.de> wrote in message <hd986n$e47$1@fred.mathworks.com>...
>
> "happydude Hudson" <hud_wa@hotmail.com> schrieb im Newsbeitrag
> news:hd983a$782$1@fred.mathworks.com...
> >I have a two column vectors (Vector A and Vector B).
> >
> > Both are randomly assigned 1 or 0 for each row.
> >
> > I want to use a vectorized if statement to test if each row of A equals
> > the corresponding row of B and put the output in a corresponding row of
> > Vector C.
> >
> > ie. column Vector C will end up being something like:
> > "true"
> > "false"
> > "false"
> > "true"
> >
> > etc
> >
> > how would I do this?
> >
>
> if they are vectors then C should just be
> C = (A == B)
>
> Titus
> ( ) are not necessary, just to make it more readable ...
>
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.