system() call not executing a command

2 visualizaciones (últimos 30 días)
Tim
Tim el 3 de Jul. de 2013
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 comentario
Tim
Tim el 3 de Jul. de 2013
Editada: Tim el 3 de Jul. de 2013
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Software Development Tools en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by