MATLAB: Help with string return of a Popupmenu in GUI

MATLABmatlab guipop-up menu return

I have designed a pop-up menu ('xchannelmenu') with two strings 'ao0' and 'ao1' in a GUI created with GUIDE. I have set the strings using the Property Inspector -> String.
To retrieve the string chosen by the user when a specific button is pushed I am using the following code:
xval=get(handles.xchannelmenu,'Value');
xc=handles.xchannelmenu.String(xval);
The problem is that when the first string is selected I get the correct returned string ('ao0'), but when the second one is selected the return is:
[1x5 char]
While debugging the callback function, I have tried the command:
handles.xchannelmenu.String
which returns
ans =
'ao0'
[1x5 char]
Any idea what am I doing wrong?

Best Answer

xc=handles.xchannelmenu.String{xval}