#author("2018-05-07T19:34:50+09:00","default:Miyashita","Miyashita")
#author("2018-07-25T19:40:11+09:00","default:Miyashita","Miyashita")
*MATLABからシェルスクリプトの実行 [#n393630b]
行頭に「!」をつける.
 !./foobar.sh
#codeprettify(lang-matlab){{
!./foobar.sh
}}
.shでなくとも,実行ファイルもこれで実行できる.標準出力はMATLABのコマンドウィンドウになる.他にもLinuxであれば,
 unix('echo foo ');

 system('echo bar ');
#codeprettify(lang-matlab){{
unix('echo foo ');
}}
#codeprettify(lang-matlab){{
system('echo bar ');
}}
でできる.この2つの細かな差異は知らない.~
ls,dir,mkdir,pwdなどはMATLABのコマンドとして使用可能のため,わざわざ上記の方法でやる必要はない.~
Windowsの場合も,同じようにコマンドプロンプトのスクリプトが実行できるらしい.使ったことはないけど.~

逆?は[[こちら>../exewithbash]]

***参考 - MathWorks公式 [#x0b27ff3]
-[[system>https://jp.mathworks.com/help/matlab/ref/system.html]]~
-[[unix>https://jp.mathworks.com/help/matlab/ref/unix.html]]

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes