How to put Matlab variables into dos command

3 ビュー (過去 30 日間)
alexandre
alexandre 2012 年 4 月 5 日
Hello,
I'd like to launch a DOS command from Matlab (with dos('...')) the problem comes from DOS arguments which are Matlab variables. I've tried : dos('teuma.exe -b2a matlab_variable) but it obviously doesn't work. I've also tried to concanetate with brackets [] but without succes. Can someone help me?
Thank you very much

回答 (2 件)

Matt Tearle
Matt Tearle 2012 年 4 月 5 日
Do you want to pass the value in matlab_variable in the dos command? That is, if matlab_variable = 42, you're trying to issue the dos command "teuma.exe -b2a 42"? If so,
str = ['teuma.exe -b2a ',num2str(matlab_variable)];
dos(str)

alexandre
alexandre 2012 年 4 月 5 日
yes, it was exactly the thing I needed.. Thank you very much

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by