How can I run a matlab function in batch on Windows?
Ältere Kommentare anzeigen
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.
Antworten (1)
Jan
am 12 Feb. 2015
0 Stimmen
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 Kommentar
gconroy
am 13 Feb. 2015
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!