# Math Help - 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

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

At the console or in your script file initialise a

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

Code:
global a

CB