フィルターのクリア

Passing values to Bash script

2 ビュー (過去 30 日間)
g
g 2019 年 3 月 17 日
コメント済み: cameron morrison 2020 年 3 月 5 日
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?

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 17 日
Example:
cmd = sprintf('alpha=%d beta=%d ls | head -$beta | tail -$alpha', alpha, beta);
system(cmd)
  3 件のコメント
Walter Roberson
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
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 ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by