can we call a script from another script or only functions can be called?
24 次查看(过去 30 天)
显示 更早的评论
i have to convert the called script into funciton?
0 个评论
采纳的回答
Star Strider
2015-3-6
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 个)
Pablo Dias
2018-9-6
You can just call "scriptName;" ,without double quotes.
All variables in the caller script will be available.
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)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structural Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!