Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: extracting data from .fig in 2007a - did the proceedure change?

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Chris

Date: 23 Oct, 2007 15:33:04

Message: 1 of 8

I'd like to extract the original data from several
scatterplot .fig files. However, using load('filename','-
mat') does not produce xdata and ydata files and the file
available here "getfigdata.m" also returns an error saying
it can't find "lh".

Does anyone know where the data is actually stored in
a .fig file under 2007a?

For instance, www.gaiteri.net/intrinsic_stress.fig
is one I just need to extract this very simple information
from. Thanks!

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Chris

Date: 23 Oct, 2007 15:48:28

Message: 2 of 8

better link to file

www.gaiteri.net/stress_intrinsic.zip








"Chris " <cag44@removethispitt.edu> wrote in message
<ffl47g$q5v$1@fred.mathworks.com>...
> I'd like to extract the original data from several
> scatterplot .fig files. However, using load
('filename','-
> mat') does not produce xdata and ydata files and the
file
> available here "getfigdata.m" also returns an error
saying
> it can't find "lh".
>
> Does anyone know where the data is actually stored in
> a .fig file under 2007a?
>
> For instance, www.gaiteri.net/intrinsic_stress.fig
> is one I just need to extract this very simple
information
> from. Thanks!

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: PB

Date: 23 Oct, 2007 16:02:10

Message: 3 of 8

Den Tue, 23 Oct 2007 15:33:04 +0000 skrev Chris :

> I'd like to extract the original data from several
> scatterplot .fig files. However, using load('filename','-
> mat') does not produce xdata and ydata files and the file
> available here "getfigdata.m" also returns an error saying
> it can't find "lh".
>
> Does anyone know where the data is actually stored in
> a .fig file under 2007a?
>
> For instance, www.gaiteri.net/intrinsic_stress.fig
> is one I just need to extract this very simple information
> from. Thanks!

I get the following error trying to download your fig:

The page cannot be found...

Anyway, this might work:

%create figure

fplot(@humps,[0,1]);
saveas(gcf,'test','fig');
close(gcf); % close fig

% open the figure again
fighandle=openfig('test.fig');
ax=findall(fighandle,'Type','line');
x=get(ax,'Xdata')
y=get(ax,'YData')


HTH

PB

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Peter Boettcher

Date: 23 Oct, 2007 16:03:22

Message: 4 of 8

"Chris " <cag44@removethispitt.edu> writes:

> I'd like to extract the original data from several
> scatterplot .fig files. However, using load('filename','-
> mat') does not produce xdata and ydata files and the file
> available here "getfigdata.m" also returns an error saying
> it can't find "lh".
>
> Does anyone know where the data is actually stored in
> a .fig file under 2007a?
>
> For instance, www.gaiteri.net/intrinsic_stress.fig
> is one I just need to extract this very simple information
> from. Thanks!

load the file, then start digging through the resulting structure:

>> a = load('filename', '-mat')

a =

    hgS_070000: [1x1 struct]

>> a.hgS_070000

ans =

          type: 'figure'
        handle: 9
    properties: [1x1 struct]
      children: [2x1 struct]
       special: []

>> a.hgS_070000.children(1)
and
>> a.hgS_070000.children(2)

etc, etc, etc.

Eventually you'll find what you're looking for.

-Peter

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Dan Haeg

Date: 23 Oct, 2007 17:26:50

Message: 5 of 8

"Chris " <cag44@removethispitt.edu> wrote in message
<ffl47g$q5v$1@fred.mathworks.com>...
> I'd like to extract the original data from several
> scatterplot .fig files. However, using load('filename','-
> mat') does not produce xdata and ydata files and the file
> available here "getfigdata.m" also returns an error saying
> it can't find "lh".
>
> Does anyone know where the data is actually stored in
> a .fig file under 2007a?
>
> For instance, www.gaiteri.net/intrinsic_stress.fig
> is one I just need to extract this very simple information
> from. Thanks!

This works:

s=hgload('inlet.fig')
h = findobj(s,'Type','line')
y=get(h,'ydata');
x=get(h,'xdata');


Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Chris

Date: 23 Oct, 2007 22:35:08

Message: 6 of 8

Hi Dan - thanks for the information.

I tried your exact code on one of my figures and findobj
always returns empty.

"Dan Haeg" <haegd@msoe.edu> wrote in message
<fflasp$skn$1@fred.mathworks.com>...
> "Chris " <cag44@removethispitt.edu> wrote in message
> <ffl47g$q5v$1@fred.mathworks.com>...
> > I'd like to extract the original data from several
> > scatterplot .fig files. However, using load
('filename','-
> > mat') does not produce xdata and ydata files and the
file
> > available here "getfigdata.m" also returns an error
saying
> > it can't find "lh".
> >
> > Does anyone know where the data is actually stored in
> > a .fig file under 2007a?
> >
> > For instance, www.gaiteri.net/intrinsic_stress.fig
> > is one I just need to extract this very simple
information
> > from. Thanks!
>
> This works:
>
> s=hgload('inlet.fig')
> h = findobj(s,'Type','line')
> y=get(h,'ydata');
> x=get(h,'xdata');
>
>

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Chris

Date: 23 Oct, 2007 22:40:23

Message: 7 of 8

Hi Dan - thanks for the information.

I tried your exact code on one of my figures and findobj
always returns empty.

"Dan Haeg" <haegd@msoe.edu> wrote in message
<fflasp$skn$1@fred.mathworks.com>...
> "Chris " <cag44@removethispitt.edu> wrote in message
> <ffl47g$q5v$1@fred.mathworks.com>...
> > I'd like to extract the original data from several
> > scatterplot .fig files. However, using load
('filename','-
> > mat') does not produce xdata and ydata files and the
file
> > available here "getfigdata.m" also returns an error
saying
> > it can't find "lh".
> >
> > Does anyone know where the data is actually stored in
> > a .fig file under 2007a?
> >
> > For instance, www.gaiteri.net/intrinsic_stress.fig
> > is one I just need to extract this very simple
information
> > from. Thanks!
>
> This works:
>
> s=hgload('inlet.fig')
> h = findobj(s,'Type','line')
> y=get(h,'ydata');
> x=get(h,'xdata');
>
>

Subject: extracting data from .fig in 2007a - did the proceedure change?

From: Dan Haeg

Date: 26 Oct, 2007 01:04:30

Message: 8 of 8

"Chris " <cag44@removethispitt.edu> wrote in message
<fflt8n$cpe$1@fred.mathworks.com>...
> Hi Dan - thanks for the information.
>
> I tried your exact code on one of my figures and findobj
> always returns empty.
>
> "Dan Haeg" <haegd@msoe.edu> wrote in message
> <fflasp$skn$1@fred.mathworks.com>...
> > "Chris " <cag44@removethispitt.edu> wrote in message
> > <ffl47g$q5v$1@fred.mathworks.com>...
> > > I'd like to extract the original data from several
> > > scatterplot .fig files. However, using load
> ('filename','-
> > > mat') does not produce xdata and ydata files and the
> file
> > > available here "getfigdata.m" also returns an error
> saying
> > > it can't find "lh".
> > >
> > > Does anyone know where the data is actually stored in
> > > a .fig file under 2007a?
> > >
> > > For instance, www.gaiteri.net/intrinsic_stress.fig
> > > is one I just need to extract this very simple
> information
> > > from. Thanks!
> >
> > This works:
> >
> > s=hgload('inlet.fig')
> > h = findobj(s,'Type','line')
> > y=get(h,'ydata');
> > x=get(h,'xdata');
> >
> >
>

If it is not too late this works for your scatter plot:

s=hgload('stress_intrinsic.fig')
h = findobj(s,'Type','hggroup')
y=get(h,'ydata');
x=get(h,'xdata');

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
extract data from figure Chris 23 Oct, 2007 11:35:04
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics