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:
Trouble opening a figure

Subject: Trouble opening a figure

From: Susanne

Date: 18 Jan, 2012 20:25:10

Message: 1 of 30

I want to edit a figure (.fig file) that I made several months ago. I tried to open it like I always open figures, by the File menu, then Open. I also tried just double-clicking on it in the Current Directory. No matter how I try to open my .fig file, Matlab brings up the Import window. Other figures in same directory that I made on the same day open just fine. It's only the one that I need to edit that won't open. Any ideas as to how I can get that figure open?

Subject: Trouble opening a figure

From: Michael

Date: 30 May, 2012 20:38:11

Message: 2 of 30

I have the same problem. Did you find a solution?

"Susanne " <moskalsk@udel.edu> wrote in message <jf79r6$9ni$1@newscl01ah.mathworks.com>...
> I want to edit a figure (.fig file) that I made several months ago. I tried to open it like I always open figures, by the File menu, then Open. I also tried just double-clicking on it in the Current Directory. No matter how I try to open my .fig file, Matlab brings up the Import window. Other figures in same directory that I made on the same day open just fine. It's only the one that I need to edit that won't open. Any ideas as to how I can get that figure open?

Subject: Trouble opening a figure

From: Patrick

Date: 22 Jun, 2012 20:38:07

Message: 3 of 30

I'm not sure if this is the same problem I'm having--- I was having trouble opening files created with an earlier version, and getting an error message "Unable to open MAT file."

  
"Michael" wrote in message <jq60fj$2tv$1@newscl01ah.mathworks.com>...
> I have the same problem. Did you find a solution?
>
> "Susanne " <moskalsk@udel.edu> wrote in message <jf79r6$9ni$1@newscl01ah.mathworks.com>...
> > I want to edit a figure (.fig file) that I made several months ago. I tried to open it like I always open figures, by the File menu, then Open. I also tried just double-clicking on it in the Current Directory. No matter how I try to open my .fig file, Matlab brings up the Import window. Other figures in same directory that I made on the same day open just fine. It's only the one that I need to edit that won't open. Any ideas as to how I can get that figure open?

Subject: Trouble opening a figure

From: Stephan Heise

Date: 29 Aug, 2012 13:27:07

Message: 4 of 30

I've experienced the same problem several times. I find it very annoying not being able to rely on MATLAB's figure saving... It means I have to generate code for every figure and store that...

So, what I intended to say was: I would be interested in a solution, too!


"Susanne " <moskalsk@udel.edu> wrote in message <jf79r6$9ni$1@newscl01ah.mathworks.com>...
> I want to edit a figure (.fig file) that I made several months ago. I tried to open it like I always open figures, by the File menu, then Open. I also tried just double-clicking on it in the Current Directory. No matter how I try to open my .fig file, Matlab brings up the Import window. Other figures in same directory that I made on the same day open just fine. It's only the one that I need to edit that won't open. Any ideas as to how I can get that figure open?

Subject: Trouble opening a figure

From: dpb

Date: 29 Aug, 2012 15:40:13

Message: 5 of 30

On 8/29/2012 8:27 AM, Stephan Heise wrote:
...

> "Susanne " <moskalsk@udel.edu> wrote in message
> <jf79r6$9ni$1@newscl01ah.mathworks.com>...
>> I want to edit a figure (.fig file) that I made several months ago. I
>> tried to open it like I always open figures, by the File menu, then
>> Open. I also tried just double-clicking on it in the Current
>> Directory. No matter how I try to open my .fig file, Matlab brings up
>> the Import window....

What, specifically, does "No matter how I try to open my .fig file" include?

How, specifically, was the figure saved?

--

Subject: Trouble opening a figure

From: Stephan Heise

Date: 30 Aug, 2012 07:21:08

Message: 6 of 30

> How, specifically, was the figure saved?

(I saved my figures with the "saveas" function.)

Subject: Trouble opening a figure

From: Stephan Heise

Date: 30 Aug, 2012 07:23:07

Message: 7 of 30

dpb <none@non.net> wrote in message <k1ld4u$uq0$1@speranza.aioe.org>...
> How, specifically, was the figure saved?
> --

(I used the "saveas" function.)

Subject: Trouble opening a figure

From: dpb

Date: 30 Aug, 2012 13:31:59

Message: 8 of 30

On 8/30/2012 2:21 AM, Stephan Heise wrote:
>> How, specifically, was the figure saved?
>
> (I saved my figures with the "saveas" function.)

That's a partial answer to "specifically"...

> What, specifically, does "No matter how I try to open my .fig file"
> include?

The other specifics? Code lines themselves are less ambiguous...

--

Subject: Trouble opening a figure

From: Stephan Heise

Date: 30 Aug, 2012 14:49:06

Message: 9 of 30

dpb <none@non.net> wrote in message <k1nq0e$ika$1@speranza.aioe.org>...
> On 8/30/2012 2:21 AM, Stephan Heise wrote:
> >> How, specifically, was the figure saved?
> >
> > (I saved my figures with the "saveas" function.)
>
> That's a partial answer to "specifically"...
>
> > What, specifically, does "No matter how I try to open my .fig file"
> > include?
>
> The other specifics? Code lines themselves are less ambiguous...
>
> --

OK, the line in my function is

saveas(figurehandle, file, formats{n});

where 'figurehandle' is selfexplanatory (e.g. gcf), 'file' is the complete file name (e.g. 'D:\tmp\plot.fig'), 'formats' is a cell array (e.g. {'.fig' '.png' '.pdf'}), and 'n' is the index of a for-loop in which the above line of code is embedded.

Subject: Trouble opening a figure

From: Steven_Lord

Date: 30 Aug, 2012 15:37:54

Message: 10 of 30



"Stephan Heise" <Stephan.Heise@uni-oldenburg.de> wrote in message
news:k1nuh2$8sk$1@newscl01ah.mathworks.com...
> dpb <none@non.net> wrote in message <k1nq0e$ika$1@speranza.aioe.org>...
>> On 8/30/2012 2:21 AM, Stephan Heise wrote:
>> >> How, specifically, was the figure saved?
>> >
>> > (I saved my figures with the "saveas" function.)
>>
>> That's a partial answer to "specifically"...
>>
>> > What, specifically, does "No matter how I try to open my .fig file"
>> > include?
>>
>> The other specifics? Code lines themselves are less ambiguous...
>>
>> --
>
> OK, the line in my function is
>
> saveas(figurehandle, file, formats{n});
>
> where 'figurehandle' is selfexplanatory (e.g. gcf), 'file' is the complete
> file name (e.g. 'D:\tmp\plot.fig'), 'formats' is a cell array (e.g.
> {'.fig' '.png' '.pdf'}), and 'n' is the index of a for-loop in which the
> above line of code is embedded.

So your file is NOT a valid figure file except when you're using the first
cell in your formats cell array! It is a confusingly named image/document
file instead.

If you want to be able to open a figure using a figure file in MATLAB, it
MUST have been written using the FIG format. It is strongly encouraged
(though I'm not sure it's required) for that file to have the extension
.fig. I believe OPENFIG will accept a file with any extension, so long as it
was written using the FIG format.

A file with the extension .fig that was created using the PDF format is NOT
a figure file but is a _PDF_ file. MATLAB will not be able to recreate the
figure using that PDF file. The appropriate tool to open that file is a PDF
file viewer (something along the lines of Adobe Reader.)

http://get.adobe.com/reader/

I see that the Tips section of the reference page for SAVEAS could be
misleading; I'll ask the documentation staff to clarify that.

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

Subject: Trouble opening a figure

From: dpb

Date: 30 Aug, 2012 22:35:28

Message: 11 of 30

On 8/30/2012 9:49 AM, Stephan Heise wrote:
> dpb <none@non.net> wrote in message <k1nq0e$ika$1@speranza.aioe.org>...
...

>> The other specifics? Code lines themselves are less ambiguous...
...

> OK, the line in my function is
>
> saveas(figurehandle, file, formats{n});
>
> where 'figurehandle' is selfexplanatory (e.g. gcf), 'file' is the
> complete file name (e.g. 'D:\tmp\plot.fig'), 'formats' is a cell array
> (e.g. {'.fig' '.png' '.pdf'}), and 'n' is the index of a for-loop in
> which the above line of code is embedded.

That wasn't so hard, was it? :)

As Steve notes, only seeing what you actually did gives a clue as to
what's going wrong...help given can only be as good as the input
received w/o the proverbial crystal ball (and I'm known to complain that
mine is more often in the shop for repair than available for use).

--

Subject: Trouble opening a figure

From: Stephan Heise

Date: 31 Aug, 2012 07:20:08

Message: 12 of 30

Thanks for the answers. But the problem I sometimes encounter is with the .fig files!
(Not with the other file formats. I am aware that saveas(..., 'pdf') willl give me a pdf-file. In fact, that is what I wrote the function for: to save a figure in different formats in one shot; e.g. .png to get a figure preview in my file browser.)

I give you my most recent example:
http://www.staff.uni-oldenburg.de/st.heise/tmp/MatlabFigureOpeningProblem.fig
Trying to open this .fig file results in the Import Wizard opening.

Fortunately these corrupt figures do not occur very often but only a few times a year (maybe a little less than 1 percent of all figures). But still it means that saving figures isn't reliable :(

Subject: Trouble opening a figure

From: Bruno Luong

Date: 31 Aug, 2012 07:48:07

Message: 13 of 30

"Stephan Heise" wrote in message <k1poj8$2j0$1@newscl01ah.mathworks.com>...
>
> I give you my most recent example:
> http://www.staff.uni-oldenburg.de/st.heise/tmp/MatlabFigureOpeningProblem.fig
> Trying to open this .fig file results in the Import Wizard opening.

It contains a 3D array, not a figure graphical data.

Are you sure you manipulate correctly the handle/data variables?

Bruno

Subject: Trouble opening a figure

From: Stephan Heise

Date: 31 Aug, 2012 08:12:06

Message: 14 of 30

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k1pq7n$7m0$1@newscl01ah.mathworks.com>...
>
> It contains a 3D array, not a figure graphical data.
>
> Are you sure you manipulate correctly the handle/data variables?

You mean, I could have messed up my figure by playing with line data, legend, formatting, etc? That could well be. But then I would expect Matlab to complain on saving the figure. It's not fair to save a corrupt figure without a warning and then refusing to open it later.

Subject: Trouble opening a figure

From: Stephan Heise

Date: 31 Aug, 2012 09:22:07

Message: 15 of 30

Hey, I just stumbled upon a reproducible example (fortunately I had backed up that figure file before):

I have this figure:
http://www.staff.uni-oldenburg.de/st.heise/tmp/Example_intact.fig
which opens without a problem (by double-clicking in my file browser).

However, if I then save the figure by clicking on the "Save Figure" button in the figure window, the file size is reduced from 1.47 MB to some 70 kB, and the old problem occurs, i.e. double-clicking the .fig file opens the ImportWizard showing that the file contains some 3D-uint8 array:
http://www.staff.uni-oldenburg.de/st.heise/tmp/Example_corrupt.fig
The same happens if I use the file menu "Save" or the keyboard "Ctrl+S".

Saving the figure by using "Save as..." from the file menu or the "saveas" function increases the file size to 1.53 MB (why on earth???), but the figure seems to stay intact.

Strangely, the "Save as..." menu suggests me to save the figure in the .pcx (Paintbrush 24-bit file) format. If I do that I get a 70 kB file. So using the "Save" menu (or the "Save figure" button) seems to store the figure in the .pcx format! Anyone have an idea why Matlab treats my figure as a .pcx??

Subject: Trouble opening a figure

From: Steven_Lord

Date: 31 Aug, 2012 13:39:07

Message: 16 of 30



"Stephan Heise" <Stephan.Heise@uni-oldenburg.de> wrote in message
news:k1pvnv$oph$1@newscl01ah.mathworks.com...
> Hey, I just stumbled upon a reproducible example (fortunately I had backed
> up that figure file before):
>
> I have this figure:
> http://www.staff.uni-oldenburg.de/st.heise/tmp/Example_intact.fig
> which opens without a problem (by double-clicking in my file browser).
>
> However, if I then save the figure by clicking on the "Save Figure" button
> in the figure window, the file size is reduced from 1.47 MB to some 70 kB,
> and the old problem occurs, i.e. double-clicking the .fig file opens the
> ImportWizard showing that the file contains some 3D-uint8 array:
> http://www.staff.uni-oldenburg.de/st.heise/tmp/Example_corrupt.fig
> The same happens if I use the file menu "Save" or the keyboard "Ctrl+S".
>
> Saving the figure by using "Save as..." from the file menu or the "saveas"
> function increases the file size to 1.53 MB (why on earth???), but the
> figure seems to stay intact.
>
> Strangely, the "Save as..." menu suggests me to save the figure in the
> .pcx (Paintbrush 24-bit file) format. If I do that I get a 70 kB file. So
> using the "Save" menu (or the "Save figure" button) seems to store the
> figure in the .pcx format! Anyone have an idea why Matlab treats my figure
> as a .pcx??

Please post the output of this command:

which -all filemenufcn

If you see any file in that listing other than the filemenufcn.m in the
toolbox\matlab\uitools directory in your installation, remove those other
copies from the path and try again.

If that only shows the filemenufcn.m in the uitools directory, execute these
commands and show the output to the group:

h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure')
get(h)

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

Subject: Trouble opening a figure

From: Stephan Heise

Date: 3 Sep, 2012 07:47:06

Message: 17 of 30

"Steven_Lord" <slord@mathworks.com> wrote in message <k1qepr$gn2$1@newscl01ah.mathworks.com>...
>
> Please post the output of this command:
>
> which -all filemenufcn
>
> If you see any file in that listing other than the filemenufcn.m in the
> toolbox\matlab\uitools directory in your installation, remove those other
> copies from the path and try again.
>
> If that only shows the filemenufcn.m in the uitools directory, execute these
> commands and show the output to the group:
>
> h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure')
> get(h)
>

Hi,
sorry for the delay - didn't have Matlab at the weekend. Here's what my Matlab says:

>> which -all filemenufcn
C:\Program Files\MATLAB\R2012a\toolbox\matlab\uitools\filemenufcn.m

>> h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure');
   get(h)

ClickedCallback = filemenufcn(gcbf,'FileSave')
CData = [ (16 by 16 by 3) double array]
Enable = on
Separator = off
TooltipString = Save Figure

BeingDeleted = off
ButtonDownFcn =
Children = []
Clipping = on
CreateFcn =
DeleteFcn =
BusyAction = cancel
HandleVisibility = off
HitTest = on
Interruptible = off
Parent = [0.00146484]
Selected = off
SelectionHighlight = on
Tag = Standard.SaveFigure
Type = uipushtool
UIContextMenu = []
UserData = []
Visible = on

Subject: Trouble opening a figure

From: Radhouane BEN-HAMADOU

Date: 8 Sep, 2012 18:38:08

Message: 18 of 30

hi, I getting the same problem: unable to open saved .fig figure (edited) under matlab, the import wizard is opened instead, looking forward for the suggestions of the technical department, even if I guess that little could be recovered since the size of the files i reduced compared to others figures saved in the same day with almost the same attributes.


"Stephan Heise" wrote in message <k21n9q$10n$1@newscl01ah.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <k1qepr$gn2$1@newscl01ah.mathworks.com>...
> >
> > Please post the output of this command:
> >
> > which -all filemenufcn
> >
> > If you see any file in that listing other than the filemenufcn.m in the
> > toolbox\matlab\uitools directory in your installation, remove those other
> > copies from the path and try again.
> >
> > If that only shows the filemenufcn.m in the uitools directory, execute these
> > commands and show the output to the group:
> >
> > h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure')
> > get(h)
> >
>
> Hi,
> sorry for the delay - didn't have Matlab at the weekend. Here's what my Matlab says:
>
> >> which -all filemenufcn
> C:\Program Files\MATLAB\R2012a\toolbox\matlab\uitools\filemenufcn.m
>
> >> h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure');
> get(h)
>
> ClickedCallback = filemenufcn(gcbf,'FileSave')
> CData = [ (16 by 16 by 3) double array]
> Enable = on
> Separator = off
> TooltipString = Save Figure
>
> BeingDeleted = off
> ButtonDownFcn =
> Children = []
> Clipping = on
> CreateFcn =
> DeleteFcn =
> BusyAction = cancel
> HandleVisibility = off
> HitTest = on
> Interruptible = off
> Parent = [0.00146484]
> Selected = off
> SelectionHighlight = on
> Tag = Standard.SaveFigure
> Type = uipushtool
> UIContextMenu = []
> UserData = []
> Visible = on

Subject: Trouble opening a figure

From: Steven_Lord

Date: 10 Sep, 2012 13:57:36

Message: 19 of 30



"Stephan Heise" <Stephan.Heise@uni-oldenburg.de> wrote in message
news:k21n9q$10n$1@newscl01ah.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <k1qepr$gn2$1@newscl01ah.mathworks.com>...
>>
>> Please post the output of this command:
>>
>> which -all filemenufcn
>>
>> If you see any file in that listing other than the filemenufcn.m in the
>> toolbox\matlab\uitools directory in your installation, remove those other
>> copies from the path and try again.
>>
>> If that only shows the filemenufcn.m in the uitools directory, execute
>> these commands and show the output to the group:
>>
>> h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure')
>> get(h)
>>
>
> Hi,
> sorry for the delay - didn't have Matlab at the weekend. Here's what my
> Matlab says:
>
>>> which -all filemenufcn
> C:\Program Files\MATLAB\R2012a\toolbox\matlab\uitools\filemenufcn.m

That looks right.

>>> h = findall(gcf, 'Type', 'uipushtool', 'TooltipString', 'Save Figure');
> get(h)
>
> ClickedCallback = filemenufcn(gcbf,'FileSave')

That looks right too. Unless you or someone else modified filemenufcn I'm
not sure what's causing this. As such PLEASE contact Technical Support and
work with them to investigate further to get to the root cause of this
problem; when you do, please send them your filemenufcn.m and ask them to
check if it's the same as the one included with R2012a. It's possible some
third-party toolbox modified filemenufcn.m

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

Subject: Trouble opening a figure

From: Steven_Lord

Date: 10 Sep, 2012 13:58:13

Message: 20 of 30



"Radhouane BEN-HAMADOU" <bhamadou@ualg.pt> wrote in message
news:k2g3ag$sd0$1@newscl01ah.mathworks.com...
> hi, I getting the same problem: unable to open saved .fig figure (edited)
> under matlab, the import wizard is opened instead, looking forward for the
> suggestions of the technical department, even if I guess that little could
> be recovered since the size of the files i reduced compared to others
> figures saved in the same day with almost the same attributes.

Please contact Technical Support directly using the instructions in my
signature and work with them to determine the cause.

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

Subject: Trouble opening a figure

From: Radhouane BEN-HAMADOU

Date: 10 Sep, 2012 15:23:07

Message: 21 of 30

"Steven_Lord" <slord@mathworks.com> wrote in message <k2krlk$djo$1@newscl01ah.mathworks.com>...
>
>
> "Radhouane BEN-HAMADOU" <bhamadou@ualg.pt> wrote in message
> news:k2g3ag$sd0$1@newscl01ah.mathworks.com...
> > hi, I getting the same problem: unable to open saved .fig figure (edited)
> > under matlab, the import wizard is opened instead, looking forward for the
> > suggestions of the technical department, even if I guess that little could
> > be recovered since the size of the files i reduced compared to others
> > figures saved in the same day with almost the same attributes.
>
> Please contact Technical Support directly using the instructions in my
> signature and work with them to determine the cause.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

OK Thanks Steve, I will do but just to know what happened and prevnt for future use, because I guess noway retrieving the figure from the saved file.
Radhouan

Subject: Trouble opening a figure

From: dpb

Date: 10 Sep, 2012 16:38:18

Message: 22 of 30

On 9/10/2012 8:57 AM, Steven_Lord wrote:
...

> That looks right too. Unless you or someone else modified filemenufcn
> I'm not sure what's causing this. As such PLEASE contact Technical
> Support and work with them to investigate further to get to the root
> cause of this problem; when you do, please send them your filemenufcn.m
> and ask them to check if it's the same as the one included with R2012a.
> It's possible some third-party toolbox modified filemenufcn.m

Shouldn't he be able to find the function from the distribution medium
and check that (presuming it's an individual/student license) or the
site admin if not (altho that's often a near-impossibility to get
support from in many org's, I agree).

--

Subject: Trouble opening a figure

From: Stephan Heise

Date: 18 Sep, 2012 13:35:07

Message: 23 of 30

Meanwhile, I've been in contact with Tech Support. Here's what they say:

-------------------------------------------------------------------------
This issue is occurring because the 'Example_Intact.fig' file provided on the link has an exported figure format as 'PCX' been saved previously.
 
Following are the details:
1. Whenever a figure file is saved by using any of the file saving options, the 'filemenufcn.m' function file present in the MATLAB root directory gets executed.
 
2. This function file has a subroutine called 'localSave' which gets executed whenever a 'Save' action is performed for the figure.
 
3. This subroutine has a variable called 'typevalue' which essentially retrieves the last exported figure format using the GETAPPDATA function. If this field is empty, the subroutine will then try to retrieve it from the file extension.
 
4. MATLAB will then save the changes made to the figure file for the same retrieved format.
 
5. When I tried debugging the 'filemenufcn.m' file when saving the 'Example_Intact.fig' file, I observed that the last exported figure format for this figure has been saved as PCX, which is causing the issue. This information was captured from the 'typevalue' variable.
 
Accordingly, to work around the issue, once you have downloaded the figure from the link, please save it explicitly using the 'Save As' option as a new MATLAB figure first. For this new figure, the last exported format would be .FIG and so the issue will not occur for this figure.
 
When I tried reproducing the same issue on MATLAB R2012b, no such issue was observed. Further analysis indicated that this is because; in MATLAB R2012b the 'localSave' subroutine function in the 'filemenufcn.m' for R2012b has an additional check condition. Accordingly, if the figure that is being saved does not retrieve the variable 'typevalue' as .FIG format (as in your case), it is explicitly made to .FIG so as to successfully save it as a MATLAB figure.
 
Therefore to work around this issue, you can also try any one of the following options.
 
1. Try upgrading to MATLAB R2012b and check if the issue still occurs (Preferred)
2. If the above step is not feasible, On MATLAB Command Window type:
 
edit filemenufcn.m
 
The filemenufcn.m file will open in the MATLAB Editor Window. In 'filemenufcn.m' replace the 'localSave' subroutine (function body for 'localSave' between lines 180 and 200) by the one mentioned below (captured from 'filemenufcn.m' available in MATLAB R2012b):
 
function localSave(hfig)
filename=get(hfig,'FileName');
if isempty(filename)
  filemenufcn(hfig,'FileSaveAs');
else
  types = localExportTypes(hfig);
  typevalue = getappdata(hfig,LASTEXPORTEDASTYPE);
 
  [p, f, ext] = fileparts(filename);
  if isempty(typevalue)
      % This is here for backwards compatibility: if there is no last
      % exported as type in the figure's appdata, use the extension
      typevalue = localGetTypeFromExtension(hfig, ext);
  end
 
  % Additional Comparison done, explicitly set to .fig format
 
  if strcmpi(ext,'.fig') && ~strcmpi(ext, types{typevalue,3})
      typevalue = localGetTypeFromExtension(hfig,'.fig');
  end
 
  localSaveExportHelper(hfig, filename, types, typevalue);
end
 
Now save the 'filemenufcn.m' file and check if the issue still occurs.
-------------------------------------------------------------------------

For me this seems to work! So, the problem hopefully is solved.
Unfortunately, I still don't understand why the last exported figure format was PCX ?!? I didn't even know of this format until I started investigating this issue. Anyway, I checked, and the last exported figure format is stored in the figure's appdata as a number referencing to a row in the table of available export formats. I suspect, that maybe this table changed at some point, and the number that formerly referenced .FIG now references .PCX. But I didn't dig into this any further.

Hope this helps.

Stephan.

Subject: Trouble opening a figure

From: Steven_Lord

Date: 20 Sep, 2012 15:13:09

Message: 24 of 30



"Stephan Heise" <Stephan.Heise@uni-oldenburg.de> wrote in message
news:k39tab$e21$1@newscl01ah.mathworks.com...
> Meanwhile, I've been in contact with Tech Support. Here's what they say:

*snip*

> For me this seems to work! So, the problem hopefully is solved.
> Unfortunately, I still don't understand why the last exported figure
> format was PCX ?!? I didn't even know of this format until I started
> investigating this issue. Anyway, I checked, and the last exported figure
> format is stored in the figure's appdata as a number referencing to a row
> in the table of available export formats. I suspect, that maybe this table
> changed at some point, and the number that formerly referenced .FIG now
> references .PCX. But I didn't dig into this any further.

This is a bug and is now captured in the list of bug reports on the support
website:

http://www.mathworks.com/support/bugreports/816907

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

Subject: Trouble opening a figure

From: Md. Ali Hossain

Date: 17 Apr, 2013 01:06:10

Message: 25 of 30

"Susanne " <moskalsk@udel.edu> wrote in message <jf79r6$9ni$1@newscl01ah.mathworks.com>...
> I want to edit a figure (.fig file) that I made several months ago. I tried to open it like I always open figures, by the File menu, then Open. I also tried just double-clicking on it in the Current Directory. No matter how I try to open my .fig file, Matlab brings up the Import window. Other figures in same directory that I made on the same day open just fine. It's only the one that I need to edit that won't open. Any ideas as to how I can get that figure open?


Hi There. This problem has a very simple solution. This is happen when saving a file. Go to your file menu and choose save as. When saving change the file format from .pcx to .fig from the bottom drop down menu. Thats it. You can save million dollars time.

Thanks
Ali

Subject: Trouble opening a figure

From: Federico

Date: 12 Jun, 2014 16:33:15

Message: 26 of 30

OK guys, much later, I am having this same problem for different reasons.

I am using Matlab R2013a on Windows 8.1 x64.

I am sent .fig files by another Matlab user - in that case, Matlab R2012b on a Mac.

Now, on that user's computer, the .fig files open correctly. On mine, sometimes they do, sometimes I get the import wizard.

Some testing later, I see that:

1) For "ok" figures, Matlab's open() tries to identify the file type, actually finds nothing that works, and based on the file extension internally triggers openfig(), which succeeds.

2) For the failing figures, when Matlab tries to identify the file type, it eventually thinks that they are audio files (?!?!). Thus the audio code path is taken (later failing and resulting in the import wizard). Note that forcibly using openfig() by hand instead of the open() wrapper succeeds: but for these files, Matlab never gets to trying on its own.

In particular, in audioinfo.m, the line

    readPlugin = PluginManager.Instance.getPluginForRead(filename);

does not throw an exception as expected; I have verified that for "ok" images, the exception is thrown. Inside PluginManager, "ok" images have "err" as a 1x1 struct with "err.Name = FileTypeNotSupported" while failing images have "err" as a string "err = C:/Program Files/MATLAB/R2013a/toolbox/shared/multimedia/bin/win64/audio/audiofilemfreaderplugin.dll".

Note that, at a visual inspection, nothing major distinguishes the files: image size, image content, and even with a binary editor the file preamble looks the same.

Looks like there's a plugin bug here. Is it a known issue? Do I need to upgrade my whole Matlab release?

Subject: Trouble opening a figure

From: Steven Lord

Date: 13 Jun, 2014 13:27:48

Message: 27 of 30


"Federico " <federico.angiolini@epfl.ch> wrote in message
news:lnckob$o40$1@newscl01ah.mathworks.com...
> OK guys, much later, I am having this same problem for different reasons.
>
> I am using Matlab R2013a on Windows 8.1 x64.
>
> I am sent .fig files by another Matlab user - in that case, Matlab R2012b
> on a Mac.

Sent how? Email, FTP, network drives, copying to some form of memory stick,
etc? Figure files are binary files -- if sent using transfer mechanisms that
only work for ASCII files, they are going to be mangled.

> Now, on that user's computer, the .fig files open correctly. On mine,
> sometimes they do, sometimes I get the import wizard.
>
> Some testing later, I see that:
>
> 1) For "ok" figures, Matlab's open() tries to identify the file type,
> actually finds nothing that works, and based on the file extension
> internally triggers openfig(), which succeeds.
>
> 2) For the failing figures, when Matlab tries to identify the file type,
> it eventually thinks that they are audio files (?!?!). Thus the audio code
> path is taken (later failing and resulting in the import wizard). Note
> that forcibly using openfig() by hand instead of the open() wrapper
> succeeds: but for these files, Matlab never gets to trying on its own.
>
> In particular, in audioinfo.m, the line
>
> readPlugin = PluginManager.Instance.getPluginForRead(filename);
>
> does not throw an exception as expected; I have verified that for "ok"
> images, the exception is thrown. Inside PluginManager, "ok" images have
> "err" as a 1x1 struct with "err.Name = FileTypeNotSupported" while failing
> images have "err" as a string "err = C:/Program
> Files/MATLAB/R2013a/toolbox/shared/multimedia/bin/win64/audio/audiofilemfreaderplugin.dll".
>
> Note that, at a visual inspection, nothing major distinguishes the files:
> image size, image content, and even with a binary editor the file preamble
> looks the same.
>
> Looks like there's a plugin bug here. Is it a known issue? Do I need to
> upgrade my whole Matlab release?

If changing the transfer mechanism doesn't resolve the problem, please zip
up one or more of the files that are being considered audio files (use the
ZIP function) and send that ZIP file to Technical Support for investigation.

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

Subject: Trouble opening a figure

From: Federico

Date: 26 Jul, 2014 23:47:07

Message: 28 of 30

Dear Steven,

thanks a lot for your quick feedback. Somehow I failed to set up reply notifications so I saw your message only now.

To answer your question: by email. I agree, mangling might in theory happen. However we are talking about mails from a fixed user, using a fixed version of Matlab (I think 2012a/64 on Mac) and a fixed mail client, a certain percentage of whose attachments would exhibit the wrong behaviour despite obviously containing the appropriate data (openfig() opens them fine), even across attachments to the same mail.

***Good news*** is: R2014a (still 64bit version on Windows 8.1), which I just installed, opens all files properly, according to my testing. R2013a/64, still installed alongside on the same system, keeps repeatably choking on some of them. It seems the bug has been fixed!

If this ex-issue is still relevant to Mathworks, I can send example files as you suggested. However I'm a newbie to Matlab, so when you say "send to Technical Support" I'm not sure to what address/webpage exactly.

Kind regards!

Subject: Trouble opening a figure

From: Steven Lord

Date: 28 Jul, 2014 15:43:01

Message: 29 of 30


"Federico " <federico.angiolini@epfl.ch> wrote in message
news:lr1elr$eqr$1@newscl01ah.mathworks.com...
> Dear Steven,
>
> thanks a lot for your quick feedback. Somehow I failed to set up reply
> notifications so I saw your message only now.
>
> To answer your question: by email. I agree, mangling might in theory
> happen. However we are talking about mails from a fixed user, using a
> fixed version of Matlab (I think 2012a/64 on Mac) and a fixed mail client,
> a certain percentage of whose attachments would exhibit the wrong
> behaviour despite obviously containing the appropriate data (openfig()
> opens them fine), even across attachments to the same mail.

That is strange.

> ***Good news*** is: R2014a (still 64bit version on Windows 8.1), which I
> just installed, opens all files properly, according to my testing.
> R2013a/64, still installed alongside on the same system, keeps repeatably
> choking on some of them. It seems the bug has been fixed!
>
> If this ex-issue is still relevant to Mathworks, I can send example files
> as you suggested. However I'm a newbie to Matlab, so when you say "send to
> Technical Support" I'm not sure to what address/webpage exactly.

See the last line of my signature. I would suggest sending an example to
Technical Support indicating you believe this issue has been fixed in
release R2014a, and ask Technical Support to confirm that. It may be that we
have fixed the underlying issue, or it may be that we simply made it less
likely to occur and you may encounter this same issue in the future albeit
less frequently (in which case Support can report the issue to development
and ask them to fix it once and for all.)

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

Subject: Trouble opening a figure

From: Federico

Date: 29 Jul, 2014 16:26:11

Message: 30 of 30

Done as instructed. Thanks!

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