フィルターのクリア

Creating an automation script that will run a series of problems

2 ビュー (過去 30 日間)
Kevin Burg
Kevin Burg 2021 年 6 月 27 日
編集済み: Jonas 2021 年 6 月 27 日
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

採用された回答

Jonas
Jonas 2021 年 6 月 27 日
編集済み: Jonas 2021 年 6 月 27 日
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 (?)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by