I have a script that performs a lot of computation on startup, and defines some functions, and I want to ensure it is all loaded when I run other scripts. I'm running Octave 5.1.0
configured for x86_64-w64-mingw32
.
I initially tried call the script only if one of its variables didn't exist('varName')
. That doesn't seem to work, so I marked a lot of the variables global
, but they still aren't loaded into global, and the functions aren't either. The script works well if I call it from the top level of the REPL or the other script's top level (but not inside an if
test). I also checked out other questions like octave: load many functions from single file.
This is what I want to do:
global all;
if (!exist('all'))
prepareData
endif
I am wondering how to expose the global variables and functions in the prepareData
script only the first time it is run.