MATLAB: How to declare global variable global variable I have multiple m-files and i want to use same global variable for all files so how should i declare and on which place Best Answer function y=fcn1(~)global your_variabledo it in all your functions Related SolutionsMATLAB: Declare global variable in simulink Global variables work differently in Simulink. Seehttps://www.mathworks.com/help/simulink/ug/using-global-data-with-the-matlab-function-block.html MATLAB: Set the Variable ‘Global’ in GUI If you want to use it in any callback use guidatahandles.yourvar=yourvarguidata(hObject,handles)To use the variable yourvaryourvar=handles.yourvar Related QuestionConvert variable to globalHow to declare multiple global variables
Best Answer