Filter löschen
Filter löschen

Creating an automation script that will run a series of problems

2 Ansichten (letzte 30 Tage)
Kevin Burg
Kevin Burg am 27 Jun. 2021
Bearbeitet: Jonas am 27 Jun. 2021
I am trying to automate a run script. I have the script performing the actual calculations with all the functions in a directory called 'Source'. Then the files unique the problem such as geometry, boundary conditions, and initial conditions are in a directory for the specific problem (i.e 'Problem1', 'Problem2' through 'Problem6'). Additionally, there is a post processing script in each problem folder called post.m. I'm doing this so I dont have to keep switching folders and can run all six problems simulataneously.
I am having problems with the structure of the script though and am getting errors in 'run', which is a command I am using. Below is my automation script. Thanks for taking a look
for i = ['Problem1','Problem2','Problem3','Problem4','Problem5','Problem6']
addpath('C:\Users\me\Documents\GitHub\Project\Problems\i')
run('C:\Users\me\Documents\GitHub\Project\Source\run_analysis.m')
run('post.m')
end

Akzeptierte Antwort

Jonas
Jonas am 27 Jun. 2021
Bearbeitet: Jonas am 27 Jun. 2021
your i will run through each character of your string you combined with your [ ] (like horzcat), it will be P, then r, then o and so on.
what you maybe want is
myPaths={'Problem1','Problem2','Problem3','Problem4','Problem5','Problem6'};
addpath('C:\Users\me\Documents\GitHub\Project\Source\');
for pathNr=1:6
cd(['C:\Users\me\Documents\GitHub\Project\Problems\' myPaths{pathNr}]);
run_analysis();
post();
end
using run() changes the directory to the file called and changes back after execution, so that's not that what you want here because you want to run the same code in each folder (?)

Weitere Antworten (0)

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by