"Christine Braganza" wrote in message <oblj0f$i9n$1@newscl01ah.mathworks.com>...
> I'm trying to ask matlab if the (4,3) value of matrix G is equal to 5, 2 or 1.
>
> The matrix value of G(4,3)==2, but when I input (G(4,3)==(2||1||5)) it says the ans =0
> How do I ask if the variable value is one of three values?
>
> I tried putting in G(4,3)==(4||5) and the answer was 0 (so untrue) but then I took away the brackets, G(4,3)==4||5 and the answer was 1(true)
>
> So I tried putting in G(4,3)==16||65 (these values don't even exist in my matrix, and it came out with the answer 1, true?! I don't know why though.
(G(4,3)==2) || (G(4,3)==1) || (G(4,3)==5)
Best wishes
Torsten.
> I'm trying to ask matlab if the (4,3) value of matrix G is equal to 5, 2 or 1.
>
> The matrix value of G(4,3)==2, but when I input (G(4,3)==(2||1||5)) it says the ans =0
> How do I ask if the variable value is one of three values?
>
> I tried putting in G(4,3)==(4||5) and the answer was 0 (so untrue) but then I took away the brackets, G(4,3)==4||5 and the answer was 1(true)
>
> So I tried putting in G(4,3)==16||65 (these values don't even exist in my matrix, and it came out with the answer 1, true?! I don't know why though.
(G(4,3)==2) || (G(4,3)==1) || (G(4,3)==5)
Best wishes
Torsten.