pwan
pwan

Reputation: 707

MATLAB - how to pass argument with command line and run the script

I Have a matlab script dbEval.m:

function dbEval()

....function implementation
....
end


 dbEval();%call this function.

I run this script on the shell with

matlab dbEval.m

Now if I want to pass a argument thru command line execute. How can I do it? and how do I retrieve the argument on my script and use it as argument of my dbEval function?

Upvotes: 0

Views: 2496

Answers (2)

smttsp
smttsp

Reputation: 4191

You can also try:

matlab -r -nodesktop -nojvm 'dbEval(arg1 arg2 ...)'

Upvotes: 0

fatihk
fatihk

Reputation: 7919

You can do like this:

matlab -r 'dbEval(argument1, ... ,argumentN)';

or

matlab -r 'try dbEval(argument1, ... ,argumentN); catch; end; quit'

Upvotes: 2

Related Questions