Passing values to Bash script
2 次查看(过去 30 天)
显示 更早的评论
Let's say I have a matlab file that calculates some values, giving:
alpha = 7
beta = 9
Now, I want to pass these values to a Bash script for use.
What is the syntax for doing this?
0 个评论
采纳的回答
Walter Roberson
2019-3-17
Example:
cmd = sprintf('alpha=%d beta=%d ls | head -$beta | tail -$alpha', alpha, beta);
system(cmd)
3 个评论
Walter Roberson
2019-3-17
cmd = sprintf('first_variable=%d second_variable=%d third_variable=%d command to execute goes here and refers to $first_variable and $second_variable and $third_variable', first_var, second_var, third_var)
cameron morrison
2020-3-5
i can't seem to get this to work at all. Is there anything I have to write on the Linux command line?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!