octave-maintainers
[Top][All Lists]
Advanced

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

Re: evaluation order in matlab/octave


From: Jaroslav Hajek
Subject: Re: evaluation order in matlab/octave
Date: Sat, 27 Sep 2008 19:17:57 +0200

On Sat, Sep 27, 2008 at 5:59 PM, Levente Torok <address@hidden> wrote:
> Hi!
>
> The following expression runs differently on octave than on matlab:
>
> function z = f( par )
>    if ( nargin==0 | isempty(par) )
>        z=3;
>    end
> end
>
> Calling
>        f;
> results in differences.
>
> In matlab if the first part of the if statment is true, the second term is 
> not evaluated hence it
> runs fine.
> In octave it raieses and error that par is not defined.
> Is there a way to overcome this or it would cause too much work.
>

You can simply use || and && in Octave.


> Lev
>
> --
> Blogger of http://fapuma.blogspot.com
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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