フィルターのクリア

system() call not executing a command

1 回表示 (過去 30 日間)
Tim
Tim 2013 年 7 月 3 日
I'm trying to run an external program within a MATLAB class. The command doesn't seem to execute in the shell (ubuntu 12.04, MATLAB 2012b).
commandstring = sprintf('avl %s %s < %s &', avlfilepath, runfilepath, commandfilepath);
result = system(commandstring);
The issue isn't with the commandstring, upon inspection it looks okay:
avl /tmp/URDF.avl /tmp/URDF.run < /tmp/myavlcommands.txt &
When I copy and paste this into the terminal, it executes perfectly. If I examine the output with the second output argument out of system, it is an empty string. Running the command in the terminal produces a host of text that comes through stdout.
Other commands like system('echo hi') and system('gedit test.txt') execute fine though.
I've also tried taking the ampersand off the end of the command, but then the text file doesn't get properly piped in to the executable when it is run through system().
I'm out of ideas. Anyone have any ideas or seen any similar problems?
  1 件のコメント
Tim
Tim 2013 年 7 月 3 日
編集済み: Tim 2013 年 7 月 3 日
Seems to be a workaround--the program was written in FORTRAN. This workaround works (well enough for me), but if anyone has a more elegant answer/explanation, I'd still appreciate it.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by