Date: Jan 3, 2013 9:38 AM
Author: Steven Lord
Subject: Re: How to run .exe file from matlab



"Hema " <hema.wadhwa@intecsea.com> wrote in message
news:kc3hia$gja$1@newscl01ah.mathworks.com...
> Hi walter,
>
> I am runing an executable from matlab, but I have more than one file as
> input file. What will be the solution in that case?
> fname1 = dat1234.dat';
> fname2 = dat1234.dat';
> fname 3= dat1234.dat';
>
> system(['C:\......\anyexecutable.exe <', fname1,fname2,fname3]);
>
> I shall apreciate any help with this.


The easiest way is to have your function accept an arbitrary number of
string inputs and LOAD or use your custom file format reader function to
read in the data from the files whose names you pass into the executable.

function anyexecutable(varargin)
mydata = cell(1, nargin);
for whichdata = 1:nargin
mydata{whichdata} = load(varargin{whichdata});
end

Call this as:

anyexecutable dat1234.dat dat2345.dat dat3456.dat

Now the data from the third file whose name you specified is stored in
mydata{3}

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com