MATLAB: How to get dynamic/changing text or data in MATLAB GUI in a panel window?

guiloopstringtext;

How can I manipulate text/numerical data from my matlab code onto my GUI in a panel box?
I want to print values from data in my script and have them on my GUI. I'm aware of static text and the edit text box, but I want the text which is displayed to come from values in my script. Example from data in my script:
Value = 50;
Then I want matlab to print Value to a panel on my GUI where a static text box says –
My number is:
Value
i.e My number is:
50

Best Answer

Call set():
set(handles.staticText1, 'String', num2str(value));
You might even be able to get away with not using num2str() - I'd have to try it to see though. Obviously replace staticText1 with whatever name you gave to the "tag" property of the edit text or static text control that you want to set the value of. So bottom line, whenever you want to change or update the value of the text control, call set().
However, one watch out : If you're in an intensive loop it might not have a chance to update the GUI before it goes racing along with your loop. It might even finish your loop without ever updating the text. If that happens, put a " drawnow " command right after the "set" command.