How to extract data from a figure which contains a uitable?
1 view (last 30 days)
Show older comments
Hi I'd like to extract data from a saved .fig file which contains a uitable. And I want to load the data into a matrix, so that I can use it in another matlab function. How to do it? I tried the following code:
open('(2039,2,0,1).fig');
%(2039,2,0,1).fig is the file to extract data from
x=get(gcf,'Children');
display(x);
And matlab gives me a number not in my figure.
So how to do it? Thanks a lot in advance!
0 Comments
Accepted Answer
Matt Kindig
on 23 Jul 2012
The number that is given when you do get(gcf,'Children') is the handle to one of the child objects (presumably the uitable if that's the only object in the figure). You can check this by checking the 'type' property of x.
To get the data,
x = get(gcf,'Children');
if strcmpi( get(x,'type'), 'uitable'), %x is uitable
data =get(x,'Data'); %this is the uitable data
end
2 Comments
Matt Kindig
on 24 Jul 2012
Or for a situation where you have multiple objects (including a uitable):
x = findobj(gcf,'Type','uitable');
if ~isempty(x),
data = get(x,'Data');
end
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps 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!