How can I run a matlab function in batch on Windows?
Mostrar comentarios más antiguos
Hi,
I am working with R2011a on a Windows 7 desktop computer.
I have an m file that requires two input parameters (input file, output file). It works just fine. I need to run this file and call the same function using different input files.
What I thought would work was to write a simple Perl script, store input arguments, system the Matlab function passing arguments one by one. Ideally, Matlab would wait for the function to be done with an input file, and then start processing the next input file.
However, it did not work. My command line on cygwin looks like this:
foreach my $input (@inputs){
my $command = ` matlab.exe -nodesktop -nojvm -nodisplay -nosplash -minimize -wait -r "cd('C:/Users/working_directory'); process_input_file('input.txt', 'output.txt'); disp('success'); exit"
}
Any pointer would be greatly appreciated.
Thank you.
Respuestas (1)
Jan
el 12 de Feb. de 2015
0 votos
The PERL code does not depend on the contents of the input "inputs". You are calling Matlab with exactly the same input files. Is this the behavior that you explain by "it did not work"? Or do you observe any other problem?
If the question concerns PERL, please visit a PERL forum, because the Matlab part is fine.
Why don't you create the loop inside Matlab directly?
1 comentario
gconroy
el 13 de Feb. de 2015
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!