I would like to know if it possible to pass directly a custom argument when executing an octave script from Powershell/batch in general. Lets make an example:
$octaveExePath = "C:\Octave\Octave-7.1.0\mingw64\bin\octave-cli.exe"
# Executing the script
& $octaveExePath test.m "some_custom_string"
is there a way to receive the custom argument from inside the test.m
script?
EDIT 1
I've done what suggested by @Ander without succes, I suppose that in this situation matlab and octave beaviuor are really different. My result making and example.m
file
function []=example(arg1)
disp(arg1)
endfunction
then calling it from powershell
& "C:\Octave\Octave-7.1.0\mingw64\bin\octave-cli-7.1.0.exe" example.m asd
Return the error
error: 'arg1' undefined near line 2, column 7
error: called from
example at line 2 column 2
EDIT 2
To be more specific my goal is to know if there is a way to pass argument from a shell directly to an octave program without using some external file as done for example in this artcile