How to get dynamic/changing text or data in MATLAB GUI in a panel window??
Show older comments
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
Accepted Answer
More Answers (1)
Walter Roberson
on 19 Dec 2013
A = uicontrol('Style','text','max',2, 'Units', 'norm', 'Position',[0 0 1 1]);
S = {'My value is:'};
for K = 1 : 10
S{2} = sprintf('%d', K);
set(A, 'String', S);
pause(1/2);
end
3 Comments
P
on 19 Dec 2013
Walter Roberson
on 19 Dec 2013
Your GUI cannot pull the values calculated from your script. Your script will have to push values to the GUI.
To get text onto the GUI, you will need to use text(), which works in a graphics axis, or you will need to set() a property of a uicontrol() that you already created and put into position. Yes, you will need handles to do this. You can add a Tag property to the output component to allow you to find the component without knowing its handle ahead of time.
P
on 19 Dec 2013
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!