help-octave
[Top][All Lists]
Advanced

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

Re: using system() command for batch processing in octave


From: Nicholas Jankowski
Subject: Re: using system() command for batch processing in octave
Date: Fri, 24 Mar 2017 11:36:31 -0400

On Thu, Mar 23, 2017 at 10:52 PM, christoph <address@hidden> wrote:
Hello I'm new to Octave and was wondering if it is possible to do batch processing,

wonderful would be something like

first run
system(command -opt1 -in  -out1)
second run
system(command -opt2 -in  -out2)

I first started using Octave doing exactly this. Sort of a brute force parameter sweep tool for an external program. works very well for programs that take text input/output files.  I used it for Elmer (finite element analysis) for that reason.  General process was to create dummy input files, use octave and for loops to script parameter sweeps, and file/string i/o commands to build complete input files. then call the program with the system command as you said, naming output files according to the looped parameter.
 

doesn't work for me!

Why?


not sure exactly. you just pass a string to system() and it should execute. the string should be part of the for loop, with part of the options depending on the loop variable. is your problem building the string or that the system command doesn't seem to run right with the string? have you built up some simple test cases? call a couple simple system commands to create a text file with your variable string or something similar.

ALso, what OS are you running on? It shouldn't matter, but there are a few options for the system command regarding sync or async behavior, how to send the output, etc, that can change behavior. maybe it matters for your case.  Here's a really simple example if you're using Windows. 

for idx = 1:3
  system(['dir >> test',num2str(idx),'.txt']);
endfor

this should create three text files names test1.txt, test2,txt, and test3.txt, each containing the file contents of you current working directory.

Nick J.

reply via email to

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