strange behaviour when running a script via "run"

Carlo de Falco carlo.defalco at gmail.com
Sun Apr 19 15:03:52 CDT 2009


Hi,

I have the following line in my .octaverc to load the sundials toolbox:

run /opt/sundials/2.3.0/sundialsTB/startup_STB.m

Since I built and installed the current mercurial tip on OSX this has  
stopped working,
I believe this is due to a strange behaviour when running scripts with  
the "run" command.

For example with the following very simple script:

---------------------------------------------------
 >> type startup_STB
startup_STB is the user-defined function defined from: /Users/carlo/ 
Desktop/test/startup_STB.m

stb_path = '/opt/sundials/2.3.0';
stb = fullfile(stb_path,'sundialsTB');
printf(["stb=" stb "\n"]);
printf(["stb=" stb "\n"]);
---------------------------------------------------

I get

---------------------------------------------------
 >> version
ans = 3.1.55
 >> run startup_STB.m
stb=/opt/sundials/2.3.0/sundialsTB
`stb' undefined near line 4 column 16
error: called from `startup_STB' in file /Users/carlo/Desktop/test/ 
startup_STB.m near line 4, column 1
error: called from:
error:   /Users/carlo/Desktop/OF/octave/octave-hg/scripts/ 
miscellaneous/run.m at line 53, column 7
---------------------------------------------------

i.e. the variable "stb" exists when referenced in the first printf  
command but it's undefined when printf is called the second time.
If the script is launched directly, everything seems to work fine

---------------------------------------------------
 >> startup_STB
/opt/sundials/2.3.0/sundialsTB
/opt/sundials/2.3.0/sundialsTB
---------------------------------------------------

c.



More information about the Bug-octave mailing list