MATLAB Answers

Is it possible to run multiple scripts in different file paths from one single script?

31 ビュー (過去 30 日間)
Harrison Schipke
Harrison Schipke 2018 年 11 月 1 日
コメント済み: Harrison Schipke 2018 年 11 月 2 日
Ive made a number of scripts to process some data I have obtained from testing. I have organised this data (.xlsx files) into different folders depending on what variable was tested. In each of these folders I have made a matlab script to do some calculations and produce graphs for the data.
Rather then having to run each script individually, is it possible to just have a single script so when I run it, the other scripts will also run?
This "master" script file would be the highest file in the directory path.
% Master Script
../myfiles/masterscript.m
% Script 1
../myfiles/Test Volume 1/script1.m
% Script 2
../myfiles/Test Volume 2/script2.m
% etc
Each script uses xlsread to gather data from excel files in their respective folders which contain the test data.
All my scripts work as they are meant to. But I am having trouble trying to run them all from a single script.
This is my current "master" script.
%===============CODE TO RUN ALL SCRIPTS===============%
%---------------------------------------%
START_1 = 'Expansion 0% Starting';
disp(START_1)
addpath /Principle Mufflers/Expansion 0/
Volume_0;
rmpath /Principle Mufflers/Expansion 0/
END_1 = 'Expansion 0% Finished';
disp(END_1)
clear
%---------------------------------------%
I only start learning matlab a week ago, so apologies if these questions are stupid, or if my code (and understanding) is not tidy.

  0 件のコメント

サインインしてコメントする。

回答 (1 件)

Elias Gule
Elias Gule 2018 年 11 月 1 日
Use the 'run' function. If you want to know how to use this function: type the command 'doc run' on the command window. Ta!

  1 件のコメント

Harrison Schipke
Harrison Schipke 2018 年 11 月 2 日
I am aware of the run function. It was having trouble to run the files in the different file paths

サインインしてコメントする。

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by