Reputation: 11473
I feel like this must be very easy, but I can't find the answer anywhere. In octave (and probably matlab but I haven't verified), you can source the contents of a file by doing
source /path/to/filename
However, let's say I have the filename stored in a variable called file. If you do source file
, it treats file
as the path rather than what is stored in file. I have tried inserting eval
in various places but if that is the answer, I haven't found the correct invocation. I don't know much octave; there is surely a trivial answer to this that I am overlooking?
Upvotes: 3
Views: 896
Reputation: 11810
Not sure about octave, but try to use a function call
source(fname)
That's what you do in matlab at least.
Upvotes: 2