Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
numerics from a filename.fig file

Subject: numerics from a filename.fig file

From: David Epstein

Date: 5 Dec, 2011 23:48:08

Message: 1 of 4

I have a Matlab-created .fig file that displays a surface in 3D. You can suppose that it's created by a specific Matlab function, such as "surf", though I hope you don't have to know this.

Is it possible to extract the numerical data from this .fig file. In particular, if the .fig file is using a collection of N (x,y,z) points, how can I obtain from the figure a 3xN matrix of doubles?

I suppose it would be possible to obtain the data using Unix tools, but this might not be a pleasant job. Really I would like to see (or construct myself) a Matlab program doing this. Can I arrange to treat the .fig file as a .mat file somehow, then "load" it? What would the variable names be in that case?

thanks for any help
David

Subject: numerics from a filename.fig file

From: Rune Allnor

Date: 6 Dec, 2011 00:12:41

Message: 2 of 4

On 6 Des, 00:48, "David Epstein"
<David.Epstein.s...@remove.warwick.ac.uk> wrote:
> I have a Matlab-created .fig file that displays a surface in 3D. You can suppose that it's created by a specific Matlab function, such as "surf", though I hope you don't have to know this.
>
> Is it possible to extract the numerical data from this .fig file. In particular, if the .fig file is using a collection of N (x,y,z) points, how can I obtain from the figure a 3xN matrix of doubles?
>
> I suppose it would be possible to obtain the data using Unix tools, but this might not be a pleasant job. Really I would like to see (or construct myself) a Matlab program doing this. Can I arrange to treat the .fig file as a .mat file somehow, then "load" it? What would the variable names be in that case?
>
> thanks for any help
> David

Can't be done.

Rune

Subject: numerics from a filename.fig file

From: Doug Schwarz

Date: 6 Dec, 2011 01:12:06

Message: 3 of 4

In article
<e105d8cc-849a-4506-a28f-a34723dc9177@j10g2000vbe.googlegroups.com>,
 Rune Allnor <allnor@tele.ntnu.no> wrote:

> On 6 Des, 00:48, "David Epstein"
> <David.Epstein.s...@remove.warwick.ac.uk> wrote:
> > I have a Matlab-created .fig file that displays a surface in 3D. You can
> > suppose that it's created by a specific Matlab function, such as "surf",
> > though I hope you don't have to know this.
> >
> > Is it possible to extract the numerical data from this .fig file. In
> > particular, if the .fig file is using a collection of N (x,y,z) points, how
> > can I obtain from the figure a 3xN matrix of doubles?
> >
> > I suppose it would be possible to obtain the data using Unix tools, but
> > this might not be a pleasant job. Really I would like to see (or construct
> > myself) a Matlab program doing this. Can I arrange to treat the .fig file
> > as a .mat file somehow, then "load" it? What would the variable names be in
> > that case?
> >
> > thanks for any help
> > David
>
> Can't be done.
>
> Rune

A .fig file is just a .mat file with a different suffix. You can load
it with

  load('-mat','my.fig')

then poke around the structure that is stored and you will find the X, Y
and Z points you want.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Subject: numerics from a filename.fig file

From: Steven_Lord

Date: 6 Dec, 2011 02:34:17

Message: 4 of 4



"David Epstein" <David.Epstein.spam@remove.warwick.ac.uk> wrote in message
news:jbjl7o$jor$1@newscl01ah.mathworks.com...
> I have a Matlab-created .fig file that displays a surface in 3D. You can
> suppose that it's created by a specific Matlab function, such as "surf",
> though I hope you don't have to know this.
>
> Is it possible to extract the numerical data from this .fig file. In
> particular, if the .fig file is using a collection of N (x,y,z) points,
> how can I obtain from the figure a 3xN matrix of doubles?
>
> I suppose it would be possible to obtain the data using Unix tools, but
> this might not be a pleasant job. Really I would like to see (or construct
> myself) a Matlab program doing this. Can I arrange to treat the .fig file
> as a .mat file somehow, then "load" it? What would the variable names be
> in that case?

OPEN the figure, use FINDOBJ or FINDALL to find the handle to the surface
object, then GET the XData, YData, and/or ZData properties from the surface.

http://www.mathworks.com/help/techdoc/ref/surface_props.html#XData

If you need them as a 3-by-N you can pack the property values together into
one matrix.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

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.

Contact us