GUI slider problem

hello
I create a GUI with a slider and it's max=255
i want to use it as an analog output of pin13 and control the led light
i wrote this for slider callback:

global a;
analog = get(handles.slider1,'Value');
set(handles.text1,'String',analog); ////it's for showing the slider value above it
a.analogWrite(13,analog);

but it has a error and it says the value of the analogWrite must be numerical
what can i do ?

I create a GUI with a slider

Using what language?

global a;

That doesn't look like a type to me.

what can i do ?

Define the variable a has having the correct type.

I use matlab
in matlab when you want to work with arduino in gui ,to define the board you have to use a parameter that named global a;

You seem to be hopelessly mixed up between PC code and Arduino code (assuming the GUI is on your PC).

Your PC program needs to send a number (0-255) to the Arduino and the program on the Arduino will use that to control the brightness. However you can only do analogWrite() to pins 3,5,6,9,10 and 11.

Have a look at this Python GUI demo (with slider) and at serial input basics

...R
PS I was writing this while you were writing Reply #2. Idon't know Matlab but my general comments still apply.

thanks for you reply
when i wirte in command window matlab , i wirte analogWrite(13,255) it lights the led full
that pins you said are in pwm pins
the problem is that ,in the analogWrite(pin,value) , in the value part i cant write a variable i must write a number between 0,255 but i want to write the slider and for that i must write(13,slider) and it returns error

I test it with a push button instead of slider and it works

the problem is the out put value of slider.in the analogWrite(pin,value) , value must be integer but the output pf slider isn't integer(i think)