Running command prompt via MATLAB Linux

1 回表示 (過去 30 日間)
Phat Pumchawsaun
Phat Pumchawsaun 2018 年 1 月 10 日
回答済み: Harish Ramachandran 2018 年 1 月 17 日
Hi,
I have a compiler needed to run on MATLAB environment with command prompt of Linux system and I write the code as following;
cmdstr = sprintf('filecompiler')
eval(cmdstr)
However, the is an error as below;
/bin/bash: filecompiler: command not found
I don't know what is it or is it related to location of bash file? Also, my compliler is in the location of /home/nameuser/Desktop and I have set the location of symbolic links in /usr/local/bin/
Thanks Phat
  1 件のコメント
Jan
Jan 2018 年 1 月 10 日
The question is not clear yet.
cmdstr = sprintf('filecompiler')
is the same as
cmdstr = 'filecompiler'
Using this as input to eval tries to access this string as a variable or function. It is not clear why this could cause the posted error, because "/bin/bash" is out of reach when using these commands. Do you mean
system('filecompiler')
? If so, what does "compiler needed to run on MATLAB environment" exactly mean?
What about:
system('/home/nameuser/Desktop/filecompiler')
?

サインインしてコメントする。

回答 (1 件)

Harish Ramachandran
Harish Ramachandran 2018 年 1 月 17 日
As Jan suggested, I would suggest you to use the system command which executes operating system command and return output. Thank you Jan Simon!
system('path/filecompiler');

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by