MATLAB: Gui interface code question.

matlab guimetric conversion

Hello there :), Im coding for a converter Gui. Im a starter so im having troubles in using codes. anyways..I just wanna know how can multiply variables in gui?
screen = get(handles.text1, 'String');
screen = (screen*2.54);
set( handles.text1, 'String', screen)
this is my code for converting an expected input of inch to centimeters, what is wrong here? the answer I get is wrong.

Best Answer

What you need to remember is that you are getting a string, not a number. If you want to use it as a number, you must convert from a string to a number. Then if you want to use the result as a string you need to convert from a number to a string.
screen = str2double(get(handles.text1, 'String'));
screen = (screen*2.54);
set( handles.text1, 'String', num2str(screen))