MATLAB: How to get the integer value from a edit box

edit text boxguiguidehandlesstring

The only way I know of getting the value of an edit box is getting it as a string. How do I assign it as an integer. My edit box input is '123'. How do I retrieve it and store and an integer. I tried the code below but it didnt work
widthBox=get(handles.edit5,'String');
ws = str2num(widthBox);

Best Answer

Looks like it should work. Why do you say it doesn't?