help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: system or dos command


From: Matthew Bondy
Subject: Re: system or dos command
Date: Wed, 13 Apr 2016 19:52:47 -0400

Thank you for the suggestion Fernando. However, I observe the same result with your modified system command.

It seems like my system command is running asynchronously for some reason. Or at least Octave thinks it can move to the next command whereas MATLAB is working as I intend it to and not moving on until the solver runs and closes. I tried creating the string for the solver and its input file command on a different line and removing the '-echo' command (which I may not even need in MATLAB and seems like it may not be valid in Octave with the system command). Still the same behaviour. solver.exe runs but Octave moves on to the next commands before solver.exe finishes its run.

Seems unlikely but could it have something to do with the way I run Octave in my MS batch file?
start /wait E:\Octave\octave.vbs --no-gui -V script.m

I tried using a similar syntax with Octave's system command without success (opened a new window on top of the window opened for the Octave command line):
system(['start /wait solver.exe i=' filename{1}])

Not sure what else to try.

Any suggestions would be appreciated.
- Matt

On 11 April 2016 at 23:24, Fernando Danko <address@hidden> wrote:
Try:
system(['Solver.exe i=' input_file{1}], true);

In the documentation, says:
 Built-in Function: system ("string", return_output, type)
[...]
If system is called with one or more output arguments, or if the optional argument return_output is true and the subprocess is started synchronously, then the output from the command is returned as a variable. Otherwise, if the subprocess is executed synchronously, its output is sent to the standard output. To send the output of a command executed with system through the pager, use a command like

http://www.gnu.org/software/octave/doc/v4.0.1/Controlling-Subprocesses.html

I hope to be useful,
Regards

2016-04-11 22:50 GMT-03:00 Matthew Bondy <address@hidden>:
I am trying to convert a MATLAB script to use Octave. My use of MATLAB's 'system' command in Octave is giving me trouble. Octave is not waiting for the executable initiated with the system command to finish its task. The remainder of the script post-processes data output by this executable. I tried switching to the 'dos' command. The end result is the same though it behaves a little different.

In MATLAB my system command looks like:
system(['Solver.exe i=' input_file{1}]','-echo')

In Octave I have left the '-echo' option and tried removing it. With both I also tried system and dos.

Any thoughts or suggestions would be very much appreciated.

Thanks!

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]