How can I loop through different input text files when running a .exe in Matlab?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am running a .exe file in Matlab and looping through different input arguments. This is what the code looks like:
for a = [36, 37, 38]
system(sprintf('spei.exe %d fallon_input.txt %d.txt', a, a));
end
The first argument is a time scale in months. The second argument is the input file. The input file is fallon_input.txt. And the third argument is the output file. My question is how can I loop through different input files for each set of 'a' values?
0 comentarios
Respuesta aceptada
Walter Roberson
el 29 de Mzo. de 2011
Just generalize what you have.
textfiles = {'fallon', 'jumpon', 'hopon'};
for a = [36,37,38]
for K = 1 : length(textfiles)
system(sprintf('spei.exe %d %s_input.txt %s_output_%d.txt', a, textfiles{K}, textfiles{K}, a));
end
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Language Fundamentals en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!