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!