find handle to "uitable" already placed in figure?
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, I programmatically created a figure, and in a called function added programmatically an "uitable" to the figure. After having returned from the uitable creating function, I would like to access the uitable once more in order to add another data row to it. It alternatively could also be a possibility to just delete the uitable completely and replace it by a new one. However, for both options I would need to first find the handle to the uitable. In similar cases, for instance for finding access to an Annotation TextBox again, I could use the "findall" command and then dig in the handles output for my handle of interest:
handles = findall(gcf,'Type','TextBox');
But, I cannot find any trace to a handle of my uitable which is displayed in the figure, not even from screening the full output of
handles = findall(gcf)
How do I query for the handle of my uitable, please?
2 件のコメント
Ingrid
2015 年 6 月 23 日
when you create the gui programtically, why would you want to use something like findall? Can you not just store the handle when you create the uitable (and likewise the textbox)
採用された回答
Joseph Cheng
2015 年 6 月 23 日
I'm not sure why you're having a hard time finding the uitable handle since you've gave an example of finding the textbox handles. Maybe my quick test sheds some insight that i can't see where you're going wrong.
f = figure;
data = rand(3);
colnames = {'X-Data', 'Y-Data', 'Z-Data'};
uitable(f, 'Data', data, 'ColumnName', colnames, ...
'Position', [20 20 260 300])
%displayed ans is the uitable handle
uitablehandle = findall(f,'type','uitable')
savefig(f,'uitabletestfig.fig')
txt = uicontrol('Style','text',...
'Position',[20 350 120 20],...
'String','countdown till closed');
tic
while toc<5
set(txt,'string',['countdown till closed: ' num2str(5-round(toc))])
pause(.01)
end
%%close all things and clear workspace
clear all;
close all;
uiopen('uitabletestfig.fig',1)
uitablehandle = findall(gcf,'type','uitable')
uitabledata = get(uitablehandle,'Data');
set(uitablehandle,'Data',repmat(uitabledata,3,1))
2 件のコメント
Joseph Cheng
2015 年 6 月 23 日
well... from what i gather from using findall it looks for a string compare under the type "parameter" (so its as if you wrote a loop to check each figure children for its type and return when the types match)
その他の回答 (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!