How to use system ()

7 ビュー (過去 30 日間)
Mehdi
Mehdi 2013 年 8 月 25 日
Friends,
I have this code which works fine:
system(['C:/My_program/folder_images/myexecutable.exe <' fname_path]);
But I need to use which() to determine where 'myexecutable.exe' is. So I'm trying to use this:
exe_path = which ('myexecutable.exe')
system(['exe_path <' fname_path]);
but it doesn't work. Can anybody help me please? Thank you in advance.

採用された回答

the cyclist
the cyclist 2013 年 8 月 25 日
編集済み: the cyclist 2013 年 8 月 25 日
My advice is to first just display the string, without putting it into the system() command, to see if it is correct. I think you probably want
system_command_string = [exe_path,' < ',fname_path]
because both exe_path and fname_path are already strings, and you just need to put the ' < ' in between. (But you should check that.) Then,
system(system_command_string)
should run it.

その他の回答 (2 件)

dpb
dpb 2013 年 8 月 25 日
which is a Matlab function, not a system command
Use dir() recursively instead.

Mehdi
Mehdi 2013 年 8 月 25 日
You're awesome! It worked. Thank you so very much!

カテゴリ

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