How to get the inputs given in gui by user into main code
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am looking for a code that helps me in passing tag names of all the buttons which are on in gui into the another matlab code.
Thanks in Advance.
0 个评论
采纳的回答
Walter Roberson
2019-1-21
编辑:Walter Roberson
2019-1-21
t = unique(get(findobj(0, 'type', 'uicontrol', 'style','radio', '-or', 'style', 'push'),'tag'));
t( cellfun(@isempty, t) ) = []; %remove empty tags
Now t is a cell array of the tags of only the radio and push buttons.
You might prefer to replace the 0 with the handle of the figure of the GUI.
Note also: if you used GUIDE, then some of the handles might be set to callback visibility. If so and you need to find them anyhow, then change findobj() to findall()
1 个评论
Walter Roberson
2019-1-21
t = unique(get(findobj(0, 'type', 'uicontrol', 'style','radio', 'value', 1),'tag'));
if ischar(t); t = {t}; end %can happen if only a single radio button
if isempty(t)
t = {}; %no active radio buttons found
else
t( cellfun(@isempty, t) ) = []; %remove empty tags
end
更多回答(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!