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.
system() call not executing a command
조회 수: 2 (최근 30일)
이전 댓글 표시
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?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Software Development Tools에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!