MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: On MS-Windows -- Calling MS-DOS Applications from Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45323] Re: [mg45293] On MS-Windows -- Calling MS-DOS Applications from Mathematica
  • From: Christopher Purcell <christopherpurcell at mac.com>
  • Date: Tue, 30 Dec 2003 04:14:29 -0500 (EST)
  • References: <200312290522.AAA14930@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I run a fortran code (called mavart) on Windows 2000 (and Mac OSX) with 
this little routine that is mostly from MathGroup correspondence from 
earlier this year.
The mavart code takes a data file name (by default "mav") as its only 
user input and is compiled as a "terminal application" using Absoft 
Fortran on Mac OSX and as a "console application" using Compaq Fortran 
on Windows . When it finishes the analysis it returns the console 
output as a list to Mathematica.
If your dos program does not need input you could simplify this 
considerably.
It runs the external code silently, so there is no annoying pop-up of a 
console window, which is particularly nice when doing optimizations 
involving hundreds of analyses.

Analyze::fail="Analysis has failed -  check data file is located in the 
working directory.";
Analyze::ok="Analysis is complete.";

Analyze[file_String:"mav"]:=Module[{status,log},(
If[$OperatingSystem=="MacOSX",(
status=Run["./mavart>"<>file<>".log"];
log=ReadList[file<>".log",Record];
If[status!=0,Message[Analyze::fail];$Failed,
Message[Analyze::ok];log]), (* otherwise assume this is Windows *)
ReadList["!echo "<>file<>"|mavart.exe",Record]]
)]



Christopher Purcell
Sensors & Actuators Group
DRDC-Atlantic, 9 Grove St., PO Box 1012,
Dartmouth NS B2Y 3Z7 Canada
Tel 902-426-3100 x389
Fax 902-426-9654

On Dec 29, 2003, at 1:22 AM, Harold Noffke wrote:

> Hello.
>
> I use Mathematica 5.0 on MS-Windows 2000.  Is there any way to call
> MS-DOS applications from either the MS-Windows Notebook Front End, or
> from the MS-DOS Front End?  I can find no documentation on this topic.
>
> Thanks.
> Harold
>


  • Prev by Date: Re: Compile
  • Next by Date: RE: Re: Laplacian and curlcurl with maxwells eqn's
  • Previous by thread: Re: On MS-Windows -- Calling MS-DOS Applications from Mathematica
  • Next by thread: colorfunction with scatterplot3d?