How can I put multiple functions in one file and later get access to all of them in the octave interpreter ? I don't want to have a thousand files and want to group functions together. I'd like something like 'import' in python.
When Octave defines a function from a function file, it saves the full name of the file it read and the time stamp on the file. If the time stamp on the file changes, Octave may reload the file. When Octave is running interactively, time stamp checking normally happens at most once each time Octave prints the prompt.
Command: save options file -struct STRUCT f1 f2 … Save the named variables v1 , v2 , …, in the file file . The special filename ' - ' may be used to return the content of the variables as a string. If no variable names are listed, Octave saves all the variables in the current scope.
Once you have saved all your function definitions in a single script file, use source("filename")
to have access to these functions within the interpreter.
What you're looking for is called “script files”, defined there: http://www.gnu.org/software/octave/doc/interpreter/Script-Files.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With