[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comparing two matrices
From: |
Jaroslav Hajek |
Subject: |
Re: comparing two matrices |
Date: |
Tue, 22 Jul 2008 09:58:30 +0200 |
On Tue, Jul 22, 2008 at 9:32 AM, Goebel, Juergen
<address@hidden> wrote:
> Hi,
>
> I'd like to compare two row (or column) matrices
> and get a resulting matrix in which the different
> positions are marked by a one, e.g.
>
> A = [0 1 2 3 0 1 2 3]
> B = [0 0 2 3 0 1 2 2]
>
> result: [0 1 0 0 0 0 0 1]
>
> How do I achieve this? (I already played a bit
> with the find-function but without success.)
>
it's intuitive:
result = A != B
this creates a "logical" matrix. Usually that's perfectly suitable but
occassionally you may want to convert it to another type using, e.g.
"double" or "int"
> Regards,
>
> Juergen
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz