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

Réponses (2)

Aurelien Queffurust
Aurelien Queffurust le 23 Sep 2011

1 vote

If you have the source code of sud2asc , make changes accordingly. Otherwise you will have to call the standalone within a for-loop.
Jan
Jan le 23 Sep 2011

0 votes

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

Catégories

En savoir plus sur Historical Contests dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by