How to clear all handles of style or type 'text' or 'static text' in Matlab GUI ?
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
michio
2016-9-3
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 个评论
michio
2016-9-3
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!