octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #65789] is octave bug


From: Hendrik K
Subject: [Octave-bug-tracker] [bug #65789] is octave bug
Date: Sat, 25 May 2024 21:04:41 -0400 (EDT)

Follow-up Comment #3, bug #65789 (group octave):

If I read correctly the linked octave documentation: 

"The *following* function *can* be used to detect the environment. Due to the
persistent variable it can be called repeatedly without a heavy performance
hit."
Which means that *you need to create this function on your own* and it is not
a native octave command. I just did this on my machine running octave and it
works perfectly fine.


octave:2> function retval = isOctave
rsistent cacheval;  % speeds up repeated calls

  if isempty (cacheval)
    cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
  end

  retval = cacheval;
end>   persistent cacheval;  % speeds up repeated calls
>
>   if isempty (cacheval)
>     cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
>   end
>
>   retval = cacheval;
> end
octave:3> isOctave
ans = 1



@Matlab: I could not find in the Matlab online documentation that MatLab
supports the function/command IsOctave or IsMatlab. 


--> 
Neither Octave nor Matlab provide a *native* function distinguishing between
Matlab or Octave running the code (one can image why Matlab is not doing
this). 
If you want to distinguish Octave from Matlab when running Octave, define the
above function or similar on your own and then you can use it. 
Dito on the Matlab side (
https://ww2.mathworks.cn/matlabcentral/answers/114878-how-to-determine-if-my-matlab-code-is-running-in-matlab-instead-of-octave)


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65789>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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