0

PHP has the nifty include() function to bring in external files into the main script. Is this possible in Octave? I tried using load() but I keep getting an error: error: load: unable to determine the file format of 't_whse.m' which makes me think this is the wrong way to do this or that it's actually not possible in Octave.

1 Answer 1

1

You don't need to call load, as load is reserved for loading data from a file. Instead, you just want to call the script by name. This will (if it's actually a script) execute the script and make any variables that were defined in that script accessible to the calling script.

script1.m

disp('Beginning of script1');
script2;
fprintf('Value = %d\n', value)
disp('End of script1')

script2.m

disp('Beginning of script2');
value = 2;
disp('End of script 2');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.