How to run exe file with inputs

I have earthquake data with the extension suds and I downloaded the sud2asc.exe file to convert the suds file to ascii file. The sud2asc.exe file is executed from the command window and requires the simple command for the conversion:
> sud2asc 20100901.suds 20100901.txt
The program does not read the wild card * or ?, so I have to convert all the event files individually. Since there are thousands of files, doing it individually will take an enormous time. Is there any way I can read the sud2asc.exe file in matlab and let it execute for all the events by itself?
Thanks

Answers (2)

If you have the source code of sud2asc , make changes accordingly. Otherwise you will have to call the standalone within a for-loop.
Yes.
cd('YourDataFolder'); % Set accordingly
List = dir('*.suds');
for iFile = 1:numel(List)
sudsName = List(iFile).name;
[dum, FileName] = fileparts(sudsName);
txtName = [FileName, '.txt'];
system(['sud2asc ', sudsName, ' ', txtName]);
end

Categories

Find more on Historical Contests in Help Center and File Exchange

Asked:

on 23 Sep 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!