フィルターのクリア

can we call a script from another script or only functions can be called?

21 ビュー (過去 30 日間)
tina jain
tina jain 2015 年 3 月 6 日
回答済み: noobo veryo 2021 年 1 月 27 日
i have to convert the called script into funciton?

採用された回答

Star Strider
Star Strider 2015 年 3 月 6 日
You can use the run function to run another script from your current script.
Whether you want to configure your other script to a function depends on what you want to do. A function has its own workspace, and that has definite advantages in certain situations. The script you call with run would share your current script’s workspace, with access to all its variables.
  2 件のコメント
tina jain
tina jain 2015 年 3 月 6 日
thank you
Star Strider
Star Strider 2015 年 3 月 6 日
My pleasure!

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

その他の回答 (2 件)

Pablo Dias
Pablo Dias 2018 年 9 月 6 日
You can just call "scriptName;" ,without double quotes.
All variables in the caller script will be available.
  1 件のコメント
Daniyal Arif
Daniyal Arif 2019 年 8 月 3 日
it is not working
giviingerror (undifined function)

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


noobo veryo
noobo veryo 2021 年 1 月 27 日
x=input('is your program 2D or 3D? (input: 2 or 3) \n');
if x==2
disp('Running 2D Truss Codes')
Truss_2D;
elseif x==3
disp('Running 3D Truss Codes')
Truss_3D;
else
disp('wrong dimensions')
end
As you can see, I had 2 script files (Truss_2D and Truss_3D) and I called them by simply entering their names.
you can find better explanation in matlab documentation (doc run - Tips section)

カテゴリ

Help Center および File ExchangeStructural Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by