Discussion:
Octave vs Matlab differences
(too old to reply)
Stijn
2007-04-29 16:33:11 UTC
Permalink
Hi,
I was trying to run following m-files (working fine in Matlab) in
Octave but I got a error that I could not fix. The files in question
can be found at http://faculty.smu.edu/lshampin/hpde.zip ; And the
example used was RIM.m

The error is:
error: PDEFUN does not agree with FORM.
error: evaluating if command near line 104, column 1
error: called from `setup' in file `/home/stijn/hpde/examples/setup.m'
error: evaluating assignment expression near line 52, column 5
error: called from `RIM' in file `/home/stijn/hpde/examples/RIM.m'

The part of the code in setup.m is:
input_OK = true;
switch form
case {1,3}
input_OK = isa(pdefun,'function_handle');
case 2
if isa(pdefun,'cell')
if length(pdefun) == 2
input_OK = isa(pdefun{1},'function_handle') && ...
( isa(pdefun{2},'function_handle') || ...
isnumeric(pdefun{2}) );
else
input_OK = false;
end
else
input_OK = false;
end
end
if ~input_OK
error('PDEFUN does not agree with FORM.')
end

AFAIK there is not a function that could make any difference between
Matlab and Octave. Does someone see a difference?

Thanks in advance,
Stijn
David Bateman
2007-04-30 09:12:10 UTC
Permalink
Post by Stijn
Hi,
I was trying to run following m-files (working fine in Matlab) in
Octave but I got a error that I could not fix. The files in question
can be found at http://faculty.smu.edu/lshampin/hpde.zip ; And the
example used was RIM.m
error: PDEFUN does not agree with FORM.
error: evaluating if command near line 104, column 1
error: called from `setup' in file `/home/stijn/hpde/examples/setup.m'
error: evaluating assignment expression near line 52, column 5
error: called from `RIM' in file `/home/stijn/hpde/examples/RIM.m'
input_OK = true;
switch form
case {1,3}
input_OK = isa(pdefun,'function_handle');
case 2
if isa(pdefun,'cell')
if length(pdefun) == 2
input_OK = isa(pdefun{1},'function_handle') && ...
( isa(pdefun{2},'function_handle') || ...
isnumeric(pdefun{2}) );
else
input_OK = false;
end
else
input_OK = false;
end
end
if ~input_OK
error('PDEFUN does not agree with FORM.')
end
AFAIK there is not a function that could make any difference between
Matlab and Octave. Does someone see a difference?
Thanks in advance,
Stijn
Without know what version of Octave you are referring to its pretty hard
to say. I just checked

function ret = script2()
pdefun = @(x) x + 1;
form = 1;
ret = testpde(pdefun, form);
if (! ret)
clear pdefun;
pdefun{1} = @(x) x + 1;
pdefun{2} = @(x) x - 1;
form = 2;
testpde(pdefun, form);
end
end

function input_OK = testpde (pdefun, form)
input_OK = true;
switch form
case {1,3}
input_OK = isa(pdefun,'function_handle');
case 2
if isa(pdefun,'cell')
if length(pdefun) == 2
input_OK = isa(pdefun{1},'function_handle') && ...
( isa(pdefun{2},'function_handle') || ...
isnumeric(pdefun{2}) );
else
input_OK = false;
end
else
input_OK = false;
end
end
end

Agaist 2.9.10 and it worked fine. Some further debugging of where the
code above fails might help as well, as I personally don't have other
than version 2.9.10 install. You migt have better luck with help on
older versions on ***@octave.org

D.
David Bateman
2007-04-30 09:12:26 UTC
Permalink
Post by Stijn
Hi,
I was trying to run following m-files (working fine in Matlab) in
Octave but I got a error that I could not fix. The files in question
can be found at http://faculty.smu.edu/lshampin/hpde.zip ; And the
example used was RIM.m
error: PDEFUN does not agree with FORM.
error: evaluating if command near line 104, column 1
error: called from `setup' in file `/home/stijn/hpde/examples/setup.m'
error: evaluating assignment expression near line 52, column 5
error: called from `RIM' in file `/home/stijn/hpde/examples/RIM.m'
input_OK = true;
switch form
case {1,3}
input_OK = isa(pdefun,'function_handle');
case 2
if isa(pdefun,'cell')
if length(pdefun) == 2
input_OK = isa(pdefun{1},'function_handle') && ...
( isa(pdefun{2},'function_handle') || ...
isnumeric(pdefun{2}) );
else
input_OK = false;
end
else
input_OK = false;
end
end
if ~input_OK
error('PDEFUN does not agree with FORM.')
end
AFAIK there is not a function that could make any difference between
Matlab and Octave. Does someone see a difference?
Thanks in advance,
Stijn
Without know what version of Octave you are referring to its pretty hard
to say. I just checked

function ret = script2()
pdefun = @(x) x + 1;
form = 1;
ret = testpde(pdefun, form);
if (! ret)
clear pdefun;
pdefun{1} = @(x) x + 1;
pdefun{2} = @(x) x - 1;
form = 2;
testpde(pdefun, form);
end
end

function input_OK = testpde (pdefun, form)
input_OK = true;
switch form
case {1,3}
input_OK = isa(pdefun,'function_handle');
case 2
if isa(pdefun,'cell')
if length(pdefun) == 2
input_OK = isa(pdefun{1},'function_handle') && ...
( isa(pdefun{2},'function_handle') || ...
isnumeric(pdefun{2}) );
else
input_OK = false;
end
else
input_OK = false;
end
end
end

Agaist 2.9.10 and it worked fine. Some further debugging of where the
code above fails might help as well, as I personally don't have other
than version 2.9.10 install. You migt have better luck with help on
older versions on ***@octave.org

D.

Continue reading on narkive:
Loading...