Which is best :define variables as global or pass them as arguments?

2 次查看(过去 30 天)
Hello everyone, I would like to know which is best: To define variables global in main & function like global var1, var2 or pass then as arguments to function like [out1]=functionName(var1,var2)

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-5-26
Passing them as argument is better

更多回答(1 个)

Image Analyst
Image Analyst 2013-5-26

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by