Declare multiple global variables at once

I'm writing a fairly meaty code with lots of sub functions and scripts. To avoid human error, I made a script that contains hundreds of constants and unit conversions. The code would look something like this:
function myCode
run UnitConverter;
[a,b] = mySubFunction(c,d,e)
end
Where mySubFunction would call the variables assigned in UnitConverter. However, I really don't want to declare every single individual variable as a global one such that mySubFunction can read it. Is there a better way to do this?

1 Commento

Please do not use global variables. Pass them as parameters instead.

Accedi per commentare.

Categorie

Scopri di più su Scope Variables and Generate Names in Centro assistenza e File Exchange

Richiesto:

il 2 Lug 2016

Risposto:

il 2 Lug 2016

Community Treasure Hunt

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

Start Hunting!

Translated by