Azzera filtri
Azzera filtri

Creating an automation script that will run a series of problems

2 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Jonas
Jonas il 27 Giu 2021
Modificato: Jonas il 27 Giu 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 (?)

Più risposte (0)

Categorie

Scopri di più su Search Path in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by