|
From: | Julien Martin |
Subject: | Re: Problem with octave |
Date: | Mon, 30 Aug 2010 20:22:16 +0200 |
It is. Matlab does not allow a script to contain function defintions;On 30-Aug-2010, Judd Storrs wrote:
| 2010/8/30 Julien Martin <address@hidden>
|
| What's wrong with my octave code?
|
| I'm not sure octave likes mixing functions and scripts in the same file they
| way you have here. I was able to get output by separating the function and the
| script part into separate files (imfdamput.m and imfdamputrun.m) but I didn't
| look to see if the output is reasonable.
|
| Do you happen to know if octave's behavior is different than matlab's?
Octave does.
But if the first non-comment token is "function", then Octave treats
the file as a function, not a script. So put something besides
"function ..." a the beginning of the script. For example:
1; ## This is a script, not a function.
function foo (...)
...
end
Smax = ...;
...
foo (Smax, ...)
Please see also:
http://www.gnu.org/software/octave/doc/interpreter/Script-Files.html#Script-Files
which provides more detail.
jwe
[Prev in Thread] | Current Thread | [Next in Thread] |