run function from command line
Show older comments
I want to start a matlab function from the unix command line. For now I use
matlab -nodisplay -r "functionname(argument1, argument2, argumentN);exit"
But for this the function I call needs to be in the folder where I am. Is there a way to call the function like
matlab -nodisplay -r "/path/to/functionname(argument1, argument2, argumentN);exit"
without manually adding it to the search path of matlab?
Accepted Answer
More Answers (1)
Steven Lord
on 12 Sep 2025
0 votes
I'm not 100% sure this option was available in releases R2017a or R2017b, but I'm pretty sure it was. Use the -sd startup option to cause MATLAB to start in a certain directory.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!