Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14163

Running an external program inside a Do loop

From Luiz Melo <lmelo@ufsj.edu.br>
Newsgroups comp.soft-sys.math.mathematica
Subject Running an external program inside a Do loop
Date 2013-04-12 06:16 +0000
Message-ID <kk88r9$c1b$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


Hi
I have to run an external program inside a Do loop, as in the example
below. The .exe program takes the parameter i as input from the
Input.dat file, and  generates a two-column numerical .dat file as
output. Next, the Output.dat file has to be imported and manipulated.
Since the external program takes some time to run and the Do loop runs
much faster, the external program is terminating abnormaly. I would
like to know how to tell Mathematica to wait until the external
program finishes its evaluation before to execute the Import command.
Thank you.
Luiz Melo.

Do [
 Export["Input.dat", i];
 Run["SomeMath.exe"];
 t = Import["Output.dat"];
 tpos[i] = Select[t, #[[1]] > 0 &];
 tneg[i] = Select[t, #[[1]] < 0 &], {i, 100}];

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Running an external program inside a Do loop Luiz Melo <lmelo@ufsj.edu.br> - 2013-04-12 06:16 +0000
  Re: Running an external program inside a Do loop Peter Pein <petsie@dordos.net> - 2013-04-17 06:29 +0000
    Re: Running an external program inside a Do loop debguy <johnandsara2@cox.net> - 2013-04-19 05:14 +0000

csiph-web