[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: evaluation order in matlab/octave
From: |
Levente Torok |
Subject: |
Re: evaluation order in matlab/octave |
Date: |
Sat, 27 Sep 2008 19:28:52 +0200 |
User-agent: |
KMail/1.9.6 (enterprise 0.20070907.709405) |
On Saturday 27 September 2008, you wrote:
> 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.
Thanks but I was about to use a code written to matlab.
This is it.
L
--
Blogger of http://fapuma.blogspot.com