jeudi 23 avril 2015

Function work around Matlab and Octave

I work both in Matlab and GNU Octave.

A problem i have common is that Octave have a slightly different method for creating functions as MatLab have…

Example Matlab:

function [Y1, … , YN] myfunc (x1, …,xm)
    Some things to do
end

and octave do tha same function this way

function [Y1, … , YN] myfunc (x1, …,xm)
    Some things to do
endfunction

Not a big difference but enough that matlab functions won't run at Octave and probably also other way around.

Is there a work around that a scrips starts reading of it is working in matlab or octave and then choose what function it needs?

if matlab == true
then
[]=myfunc()
elseif octave == true
[] =myfuncoct()
else
error(…)
end

Thanks hope for some help

Aucun commentaire:

Enregistrer un commentaire