help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function values vector


From: Andy Buckle
Subject: Re: function values vector
Date: Mon, 17 May 2010 17:14:51 +0100

>if "John" == "Joe "
> printf("You got the right name\n")
> else
> printf("You got the wrong name\n")
> end
You got the wrong name

On Mon, May 17, 2010 at 3:50 PM, Francesco Potortì <address@hidden> wrote:
>>It happens because if X is an array, X < PI returns a logical array
>>of the same size as X, and that is only true in the condition of an IF
>>statement if all the values in the array are true.
>
> Thank you, Joe, I should have looked at the manual, which says:
>
>   The condition in an `if' statement is considered true if its value
> is non-zero, and false if its value is zero.  If the value of the
> conditional expression in an `if' statement is a vector or a matrix, it
> is considered true only if it is non-empty and _all_ of the elements
> are non-zero.
>
> --
> Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
> ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
> via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
> (entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>



-- 
/* andy buckle */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]