Creating an automation script that will run a series of problems
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Search Path에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!