help-octave
[Top][All Lists]
Advanced

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

Re: MATLAB / Octave differences [Was: Function ending.]


From: Shai Ayal
Subject: Re: MATLAB / Octave differences [Was: Function ending.]
Date: Thu, 20 Jul 2006 06:57:47 +0300
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

John Darrington wrote:
Thanks to all those who replied to me.  The problem turned out to be
unrelated to this issue.
It seems that the behaviour of the "which" command is different.  In
the case where "name" is undefined, which("name") returns "undefined"
in Octave, but in MATLAB it returns an empty result.

The code I was trying to run relied upon the MATLAB behaviour.

Is there a flag which will change this?

J'


I don't know about a flag, but as a workaround you could check the output of which for "undefined" as well, e.g. (untested code)

tt = which(name);
exist_flag = 1;
if(~isempty(tt))
 if(strcmp(tt,"undefined"))
   exist_flag=0;
 end
else
 exist_flag = 0;
end

"exist_flag" will now tell you if name is defined.
also, you might have a look at the "exist" command

Shai



On Wed, Jul 19, 2006 at 09:33:53AM +0800, John Darrington wrote:
I've been trying to get some MATLAB code to work with Octave.

The most obvious difference between the two programs is that MATLAB
expects functions to be closed with "end" whereas Octave expects
"endfunction", even when running with --traditional.

Looking at the FAQ, http://www.gnu.org/software/octave/FAQ.html#SEC24
it cites three categories of differences:

   1. Irrelevant.
   2. Known differences, perhaps configurable with a user preference variable.
3. Unknown differences.
Clearly this doesn't belong to the #1 and it's not mentioned anywhere in
the documentation, so despite this difference being extremely obvious,
I have to conclude that it's an "Unknown difference".

Does anyone have any ideas on how to overcome this problem?

To whom should I report this Unknown Difference?


------------------------------------------------------------------------

_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave



reply via email to

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