Syntax clarity on function

1 次查看(过去 30 天)
Deepayan Bhadra
Deepayan Bhadra 2020-7-17
I have a script that goes like:
The script name is also ManageX. It doesn't look like there is any input or output. Why do we need this function here then, I wonder?
function ManageX
if
end
if
end
  1 个评论
Walter Roberson
Walter Roberson 2020-7-18
  • When you use a function instead of a script, there are more opportunities for optimization
  • When you use a script instead of a function, the entire workspace of the caller of the script is right there, and any changes you make to variables inside the script potentially affect the caller. The script needs to be careful not to accidentally affect the caller in ways the caller is not expecting

请先登录,再进行评论。

回答(1 个)

Vimal Rathod
Vimal Rathod 2020-7-23
Hi,
You can have a look at some of the answers to this question link given below. There was a healthy discussion in the forum regarding this.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by