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:
reading image file *.fig

Subject: reading image file *.fig

From: Snow White

Date: 13 May, 2009 16:27:02

Message: 1 of 9

Hello,

str='oil.fig';
imread(str)

i get the following error by executing this code:

??? Error using ==> imread at 328
Unable to determine the file format.

i have also tried load and get the following error

load(str)
??? Error using ==> load
Unknown text on line number 1 of ASCII file D:\PhD\QFD\QFD\oil.fig
"MATLAB".

i want to read oil.fig and work with that is it possible to read it like a *.jpg image ?

Bye

Subject: reading image file *.fig

From: Image Analyst

Date: 13 May, 2009 17:13:02

Message: 2 of 9

"Snow White" <gulesaman@gmail.com> wrote in message <guescm$fld$1@fred.mathworks.com>...
> Hello,
>
> str='oil.fig';
> imread(str)
>
> i get the following error by executing this code:
>
> ??? Error using ==> imread at 328
> Unable to determine the file format.
>
> i have also tried load and get the following error
>
> load(str)
> ??? Error using ==> load
> Unknown text on line number 1 of ASCII file D:\PhD\QFD\QFD\oil.fig
> "MATLAB".
>
> i want to read oil.fig and work with that is it possible to read it like a *.jpg image ?
>
> Bye
========================================
Snow White:
What application created the .fig file? Was it MATLAB'S GUIDE? If so, that is not a regular image file like bmp, tiff, jpg, png, etc. How was this "image" saved? Can you change the way it is saved so that it saves it as a regular jpg image file format like you really want?
Regards,
ImageAnalyst

Subject: reading image file *.fig

From: Steven Lord

Date: 13 May, 2009 17:32:33

Message: 3 of 9


"Snow White" <gulesaman@gmail.com> wrote in message
news:guescm$fld$1@fred.mathworks.com...
> Hello,
>
> str='oil.fig';
> imread(str)
>
> i get the following error by executing this code:
>
> ??? Error using ==> imread at 328
> Unable to determine the file format.

A file with the .fig extension is likely a MATLAB Figure file, not an image
file, and so as you realized IMREAD can't recognize it.

> i have also tried load and get the following error
>
> load(str)
> ??? Error using ==> load
> Unknown text on line number 1 of ASCII file D:\PhD\QFD\QFD\oil.fig
> "MATLAB".

LOAD is not the correct tool (as you've used it) either. That's for loading
in MATLAB MAT-files (binary data files, usually created with the SAVE
function) and sometimes text files.

The tool you most likely want to use is OPEN [or OPENFIG, which is
specifically for FIG files.] This assumes that the .fig file was created by
saving a figure in MATLAB, of course. If that's the case, OPEN or OPENFIG
will reopen that saved figure.

--
Steve Lord
slord@mathworks.com

Subject: reading image file *.fig

From: Snow White

Date: 14 May, 2009 11:39:02

Message: 4 of 9

i have tried as u suggested it opens the fig but i can not use it as a normal image. I need to access certain locations in the image and work on those! :/

"Steven Lord" <slord@mathworks.com> wrote in message <guf07f$su7$1@fred.mathworks.com>...
>
> "Snow White" <gulesaman@gmail.com> wrote in message
> news:guescm$fld$1@fred.mathworks.com...
> > Hello,
> >
> > str='oil.fig';
> > imread(str)
> >
> > i get the following error by executing this code:
> >
> > ??? Error using ==> imread at 328
> > Unable to determine the file format.
>
> A file with the .fig extension is likely a MATLAB Figure file, not an image
> file, and so as you realized IMREAD can't recognize it.
>
> > i have also tried load and get the following error
> >
> > load(str)
> > ??? Error using ==> load
> > Unknown text on line number 1 of ASCII file D:\PhD\QFD\QFD\oil.fig
> > "MATLAB".
>
> LOAD is not the correct tool (as you've used it) either. That's for loading
> in MATLAB MAT-files (binary data files, usually created with the SAVE
> function) and sometimes text files.
>
> The tool you most likely want to use is OPEN [or OPENFIG, which is
> specifically for FIG files.] This assumes that the .fig file was created by
> saving a figure in MATLAB, of course. If that's the case, OPEN or OPENFIG
> will reopen that saved figure.
>
> --
> Steve Lord
> slord@mathworks.com
>

Subject: reading image file *.fig

From: ImageAnalyst

Date: 14 May, 2009 13:42:16

Message: 5 of 9

On May 14, 7:39 am, "Snow White" <gulesa...@gmail.com> wrote:
> i have tried as u suggested it opens the fig but i can not use it as a no=
rmal image. I need to access certain locations in the image and work on tho=
se! :/
>
>
---------------------------------------------------------------------------=
---------------
Still trying to figure out what you want. Is what you want to open a
fig file (a GUI) and then save a screenshot of that GUI as an image
(say a BMP format file), and then be able to put that image into an
axes and do things with it, like check pixel values or draw things on
top of it?

Subject: reading image file *.fig

From: Snow White

Date: 14 May, 2009 13:59:03

Message: 6 of 9

yes that is precisely wat i want to do

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <8f14aae3-75af-44aa-a7f6-3abe63eddbba@n21g2000vba.googlegroups.com>...
> On May 14, 7:39?am, "Snow White" <gulesa...@gmail.com> wrote:
> > i have tried as u suggested it opens the fig but i can not use it as a no=
> rmal image. I need to access certain locations in the image and work on tho=
> se! :/
> >
> >
> ---------------------------------------------------------------------------=
> ---------------
> Still trying to figure out what you want. Is what you want to open a
> fig file (a GUI) and then save a screenshot of that GUI as an image
> (say a BMP format file), and then be able to put that image into an
> axes and do things with it, like check pixel values or draw things on
> top of it?

Subject: reading image file *.fig

From: ImageAnalyst

Date: 14 May, 2009 14:02:46

Message: 7 of 9

On May 14, 9:59 am, "Snow White" <gulesa...@gmail.com> wrote:
> yes that is precisely wat i want to do
>
>
>
> ImageAnalyst <imageanal...@mailinator.com> wrote in message <8f14aae3-75a=
f-44aa-a7f6-3abe63edd...@n21g2000vba.googlegroups.com>...
> > On May 14, 7:39?am, "Snow White" <gulesa...@gmail.com> wrote:
> > > i have tried as u suggested it opens the fig but i can not use it as =
a no=
> > rmal image. I need to access certain locations in the image and work on=
 tho=
> > se! :/
>
> > -----------------------------------------------------------------------=
----­=
> > ---------------
> > Still trying to figure out what you want.  Is what you want to open a
> > fig file (a GUI) and then save a screenshot of that GUI as an image
> > (say a BMP format file), and then be able to put that image into an
> > axes and do things with it, like check pixel values or draw things on
> > top of it?- Hide quoted text -
>
> - Show quoted text -

---------------------------------------------------------------------------=
-----------------------------------
From the help navigator on "saving figures":
Saving to a Different Format — Exporting Figures

To save a figure in a format that can be used by another application,
such as the standard graphics file formats TIFF or EPS, perform these
steps:

   1.

      Select Export Setup from the File menu. This dialog provides
options you can specify for the output file, such as the figure size,
fonts, line size and style, and output format.
   2.

      Select Export from the Export Setup dialog. A standard Save As
dialog appears.
   3.

      Select the format from the list of formats in the Save as type
drop-down menu. This selects the format of the exported file and adds
the standard filename extension given to files of that type.
   4.

      Enter the name you want to give the file, less the extension.
   5.

      Click Save.

Subject: reading image file *.fig

From: Snow White

Date: 14 May, 2009 14:26:01

Message: 8 of 9

same error :/

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <2b1a2ffe-be06-43d5-81af-e275d67ebf87@q14g2000vbn.googlegroups.com>...
> On May 14, 9:59?am, "Snow White" <gulesa...@gmail.com> wrote:
> > yes that is precisely wat i want to do
> >
> >
> >
> > ImageAnalyst <imageanal...@mailinator.com> wrote in message <8f14aae3-75a=
> f-44aa-a7f6-3abe63edd...@n21g2000vba.googlegroups.com>...
> > > On May 14, 7:39?am, "Snow White" <gulesa...@gmail.com> wrote:
> > > > i have tried as u suggested it opens the fig but i can not use it as =
> a no=
> > > rmal image. I need to access certain locations in the image and work on=
> tho=
> > > se! :/
> >
> > > -----------------------------------------------------------------------=
> ----?=
> > > ---------------
> > > Still trying to figure out what you want. ?Is what you want to open a
> > > fig file (a GUI) and then save a screenshot of that GUI as an image
> > > (say a BMP format file), and then be able to put that image into an
> > > axes and do things with it, like check pixel values or draw things on
> > > top of it?- Hide quoted text -
> >
> > - Show quoted text -
>
> ---------------------------------------------------------------------------=
> -----------------------------------
> From the help navigator on "saving figures":
> Saving to a Different Format — Exporting Figures
>
> To save a figure in a format that can be used by another application,
> such as the standard graphics file formats TIFF or EPS, perform these
> steps:
>
> 1.
>
> Select Export Setup from the File menu. This dialog provides
> options you can specify for the output file, such as the figure size,
> fonts, line size and style, and output format.
> 2.
>
> Select Export from the Export Setup dialog. A standard Save As
> dialog appears.
> 3.
>
> Select the format from the list of formats in the Save as type
> drop-down menu. This selects the format of the exported file and adds
> the standard filename extension given to files of that type.
> 4.
>
> Enter the name you want to give the file, less the extension.
> 5.
>
> Click Save.

Subject: reading image file *.fig

From: ImageAnalyst

Date: 14 May, 2009 14:36:58

Message: 9 of 9

On May 14, 10:26 am, "Snow White" <gulesa...@gmail.com> wrote:
> same error :/

--------------------------------------------
In the "Save as..." what format did you tell it to save as? I did
this
>> plot(1:10)
A little figure window appeared. Then I clicked File/save as... and
tried to save it as a bitmap (untitled.bmp) (so far seems normal
enough....) and got this horrible error:

Warning: Failed in CreateCompatibleBitmap, last error code 00000057
> In graphics\private\render at 143
  In print at 267
  In hgexport at 818
  In filemenufcn>localSaveExportHelper at 205
  In filemenufcn>localSaveExport at 315
  In filemenufcn at 55
>>
Plus a popup message box with some kind of error mentioning Help
Memory.
Seems kind of buggy.
But then I used the File/Export Setup menu and clicked on the Export
button and that seemed to create the image from the figure without any
problem.

I recommend you look at Oliver Woodford's m-file for saving a figure:
http://www.mathworks.com/matlabcentral/fileexchange/23629

Good luck,
ImageAnalyst

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