Run function with input variable from linux terminal

2 次查看(过去 30 天)
I would like to run a function from the linux terminal. The function has an input variable of type string. How do I run this specific function with the input variable and how do I add the correct path for the function? The function is a main function and will in turn run other functions. Thank you in advance!!

回答(1 个)

Grzegorz Knor
Grzegorz Knor 2011-9-21
Simple example:
matlab -nosplash -nodesktop -r "ezplot('x')"
To run function 'function_name' in 'you directory' type in terminal:
matlab -nodesktop -nosplash -r "cd('your directory');function_name('your string')"
  2 个评论
Suganth Kannan
Suganth Kannan 2016-8-7
@Erik I highly recommend that you add the -nojvm modifier in front of the -r, so MATLAB will start without starting the Java Virtual Machine, too.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by