How can I run a matlab function in batch on Windows?
Afficher commentaires plus anciens
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.
Réponses (1)
Jan
le 12 Fév 2015
0 votes
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 commentaire
gconroy
le 13 Fév 2015
Catégories
En savoir plus sur Startup and Shutdown 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!