How to clear all handles of style or type 'text' or 'static text' in Matlab GUI ?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gopichandh Danala
am 3 Sep. 2016
Kommentiert: Gopichandh Danala
am 7 Sep. 2016
I have a matlab GUI which has 30 static text boxes (handles),
I have to clear all of them before running the program again
ex:
set(handles.tumor_volue_value, 'string', num2str(tumor_volume));
set(handles.density_value, 'string', num2str(density));
set(handles.stdDensity_value, 'string', num2str(std_Density));
and so on.. 30 of this.... Is a there a single command to clear all the handles.'*' ..which are of style 'text'..
Thanks,
Gopi
0 Kommentare
Akzeptierte Antwort
michio
am 3 Sep. 2016
Have you considered using findobj function? It locates graphics objects with specific properties.
h = findobj(objhandles,'PropertyName',PropertyValue);
restricts the search to objects listed in objhandles and their descendants. For example,
h = findobj(gca,'Type','line')
finds all line objects in the current axes. Please do
doc findobj
to see more details.
4 Kommentare
michio
am 3 Sep. 2016
If I assume correctly, the static text you mentions is a uicontrol object with the 'Type' property being 'uicontrol' and 'Style' property being 'text'. If so, I am guessing if you execute the following command,
lh = findobj(gcf,'Style','text');
lh will be a list of graphs handles of the static text that exists on your GUI, represented by gcf. Then you can try the following to set 'String' properties to 'clear all of the text'.
set(lh,'String','')
Let me know how to goes.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!