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

1 view (last 30 days)
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)

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 May 2013
Passing them as argument is better

More Answers (1)

Image Analyst
Image Analyst on 26 May 2013

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!