help-octave
[Top][All Lists]
Advanced

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

Re: Distinguishing Octave from Matlab


From: David Bateman
Subject: Re: Distinguishing Octave from Matlab
Date: Fri, 15 Feb 2008 18:04:33 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070914)

Ben Abbott wrote:
>
> On Feb 15, 2008, at 11:31 AM, David Bateman wrote:
>
>> Ben Abbott wrote:
>>>
>>> On Feb 15, 2008, at 5:02 AM, David Bateman wrote:
>>>
>>>> Use Octave 3.0.0 and use the matlab syntax everywhere, in most
>>>> cases it
>>>> should then just work.. If there are any other differences that
>>>> prevent
>>>> it working then they should be reported as bugs. A function that does
>>>> what you want is
>>>>
>>>> function ret = isoctave ()
>>>> persistent isoct
>>>> if (isempty (isoct))
>>>>    isoct = exist('OCTAVE_VERSION') ~= 0;
>>>> end
>>>> ret = isoct;
>>>> end
>>>>
>>>> Regards
>>>> David
>>>
>>> Might this be added to the core functions?
>>>
>>> Ben
>>>
>> How does that help you if we can't convince mathworks to do the same?
>>
>> D.
>
> Good point <blushing>
>
> Perhaps an octave version of an existing Matlab function ("ver",
> "version", "verLessThan", ?) could do the job?
>
>

Under matlab R2007b I see

>> a = ver('matlab')

a =

       Name: 'MATLAB'
    Version: '7.5'
    Release: '(R2007b)'
       Date: '02-Aug-2007'

>> a = ver('octave')

a =

0x0 struct array with fields:
    Name
    Version
    Release
    Date

The octave "ver" function doesn't take an argument. To get the
functionality you want this way you could modify Octave's ver so that it
assumes the argument is 'octave' if it is missing and then something like

if (strcmpi (pack, "octave"))
  ## Do what is already done, plus set ret if needed
else
  lst = pkg("list");
  ret = [];
  for i = 1 : length (lst)
     if (strcmpi (pack, lst{i}.name))
       ret = struct ("Name", lst{i}.name, "Version", lst{i}.version,
"Release", [], "Date", lst{i}.date);
       break;
     endif
  endfor
  if (isempty (ret))
     ## How do you create an empty structure?
     ret = struct ("Name", [], "Version", [], "Release", [], "Date", []);
     ret(1) = [];
   endif
endif

would get the type of behavior you want as long as someone doesn't
create an "octave" toolbox in matlab or a "matlab" package in octave.

D.

--  
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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