How do I make a master script that can call other scripts?

5 ビュー (過去 30 日間)
Adriana
Adriana 2014 年 4 月 11 日
回答済み: Azzi Abdelmalek 2014 年 4 月 11 日
How would I go about doing this? I have a hw assignment with 3 different questions. I want to make a different script for each one, then make a master script that calls each one.

回答 (3 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 4 月 11 日
In your main script write
script1 % will run script1
script2 % will run script2
script3

Chandrasekhar
Chandrasekhar 2014 年 4 月 11 日
master_script.m
function1();
function2();
function3();
end of master_script.m
function1(); %implements the logic for question1
function2(); %implements the logic for question2
function3(); %implements the logic for question3

Carlos
Carlos 2014 年 4 月 11 日
Imagine you have the following 3 different .m files
function y=master(a,b)
y=y1(a)+y2(b);
function y=y2(b)
y=2*b;
function y=y1(a);
y=2*a;
When you write this in the command window
>> y=master(1,1)
y =
4
>>

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by