How to run exe file with inputs

3 visualizzazioni (ultimi 30 giorni)
Yanger Walling
Yanger Walling il 23 Set 2011
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

Risposte (2)

Aurelien Queffurust
Aurelien Queffurust il 23 Set 2011
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 il 23 Set 2011
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

Community Treasure Hunt

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

Start Hunting!

Translated by