help-octave
[Top][All Lists]
Advanced

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

Re: Beginner needs help with following syntax:


From: Francesco Potortì
Subject: Re: Beginner needs help with following syntax:
Date: Sat, 07 Nov 2009 09:41:10 +0100

>> 3. B=(U<=p);
>
>This is the same as writing
>
>  if (U <= p)
>    B = 1;
>  else
>    B = 0;
>  endif

Almost.  In the first case, one gets:

octave> typeinfo(B)
ans = bool

while in the second case one gets:

octave> typeinfo(B)
ans = scalar

To be just the same, your example should be:

if (U <= p)
  B = true;
else
  B = false;
endif

-- 
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/


reply via email to

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