# Thread: matlab global variable

1. ## matlab global variable

How can i define a global variable in matlab

global a ;
a = 56;

i cannot use the value of a inside a function

Please help me.

2. Originally Posted by AUCC
How can i define a global variable in matlab

global a ;
a = 56;

i cannot use the value of a inside a function

Please help me.
At the console or in your script file initialise a

Code:
a=36;
in the function have the line:

Code:
global a
and the function will have access to a

CB