Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: running other applications
Date: Fri, 6 Jul 2007 09:46:01 -0400
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <f6lh2p$4ie$1@fred.mathworks.com>
References: <ef5c942.-1@webcrossing.raydaftYaTP> <ef5c942.0@webcrossing.raydaftYaTP> <ef5c942.1@webcrossing.raydaftYaTP> <ef5c942.2@webcrossing.raydaftYaTP>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1183729561 4686 144.212.105.187 (6 Jul 2007 13:46:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 6 Jul 2007 13:46:01 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Xref: news.mathworks.com comp.soft-sys.matlab:417574




"Jeremy Smith" <smit1729@umn.NOSPAM.edu> wrote in message 
news:ef5c942.2@webcrossing.raydaftYaTP...
> It all depends on the program you must run. As far as I know the
> only way to have a program do what you want it to do from Matlab
> itself the program must be able to accept command line inputs. I
> suspect (and could be wrong) any other method, aside from the command
> line, would involve Java. If, however, your program does accept
> command lines you can use "eval" along with "!".
>
> FileName = 'C:\File Location\File_Name';
> eval(['! "C:\Program Files\SomeProgram\executable.exe" "' FileName
> '"])

Don't use EVAL -- you don't need to in this case.  Use SYSTEM, DOS, or UNIX 
instead of !.


theprogram = '"C:\Program Files\SomeProgram\executable.exe"';
thearguments = 'foo bar';
system(sprintf('%s %s', theprogram thearguments))


-- 
Steve Lord
slord@mathworks.com