Reputation:
I want to start matlab like any normal executable like this
matlab /path/to/some/mat_file.m argument1 argument2
apparently matlab does not play like normal executables and will just ignore my request, but you can pass it commands to evaluate after startupt like
matlab -r "disp('hi');"
but this does not help, I can use the run-command to run the mat_file.m, but I can not pass additional arguments to run so argument1 and argument2 won't be present.
I can't see a way to bring matlab to behave that way.
NOTE: I will not use cd in the -r part. There is a reason that I am in the directory that I am currently in and I won't move out.
Upvotes: 0
Views: 60
Reputation: 2426
I can see two possible solutions. First, you can add and save path of your directory for matlab, then start your function like
matlab -r "my_file(in1, in2)"
Second, if you don't like to save the path, you can addpath
in the command line, like
matlab -r "addpath('/path/to/some'); my_file(in1, in2)"
Upvotes: 1