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:
Activating GUI calls wrong version of m file

Subject: Activating GUI calls wrong version of m file

From: Jeffery

Date: 30 Sep, 2010 14:25:21

Message: 1 of 12

Hi,
I'm working with the guide mechanism in Matlab to write a small calculator. Something rather odd developed when I accumulated multiple versions of the .fig and .m file in the directory.
Now when I try to activate the gui (say xxx_V4.fig) I get an error ("Reference to non-existent field" in xxx_V3. It doesn't matter if I move the V3 files to other directories, or delete the v3 files completely. Actually if I do this I get an error indicating that the Function V3 doesn't exist.
I guess my question is "Why is execution of the gui calling older m file versions?"
The matlabb version is 7.4.0 and I'm running Windows XP

Thanks in Advance
Jeff

Subject: Activating GUI calls wrong version of m file

From: Sean

Date: 30 Sep, 2010 14:40:26

Message: 2 of 12

"Jeffery " <jmorin@evanshamilton.com> wrote in message <i826kh$n2p$1@fred.mathworks.com>...
> Hi,
> I'm working with the guide mechanism in Matlab to write a small calculator. Something rather odd developed when I accumulated multiple versions of the .fig and .m file in the directory.
> Now when I try to activate the gui (say xxx_V4.fig) I get an error ("Reference to non-existent field" in xxx_V3. It doesn't matter if I move the V3 files to other directories, or delete the v3 files completely. Actually if I do this I get an error indicating that the Function V3 doesn't exist.
> I guess my question is "Why is execution of the gui calling older m file versions?"
> The matlabb version is 7.4.0 and I'm running Windows XP
>
> Thanks in Advance
> Jeff

Type:
>>which your_mfile
into the command line and see what it returns

Subject: Activating GUI calls wrong version of m file

From: ImageAnalyst

Date: 30 Sep, 2010 14:56:17

Message: 3 of 12

On Sep 30, 10:25 am, "Jeffery " <jmo...@evanshamilton.com> wrote:
> Hi,
> I'm working with the guide mechanism in Matlab to write a small calculator.  Something rather odd developed when I accumulated multiple versions of the .fig and .m file in the directory.  
> Now when I try to activate the gui  (say xxx_V4.fig) I get an error ("Reference to non-existent field"  in xxx_V3.  It doesn't matter if I move the V3 files to other directories, or delete the v3 files completely.  Actually if I do this I get an error indicating that the Function V3 doesn't exist.  
> I guess my question is "Why is execution of the gui calling older m file versions?"
> The matlabb version is 7.4.0 and I'm running Windows XP
>
> Thanks in Advance
> Jeff

----------------------------------------------
Open your fig file in GUIDE.
Double click the figure to open the property inspector.
Look at the field for CreateFcn.
Does it say version 3 or version 4?

Subject: Activating GUI calls wrong version of m file

From: Malcolm Lidierth

Date: 30 Sep, 2010 14:56:21

Message: 4 of 12

z=load('filename.fig', '-mat')
will let you inspect the contents of the figure file (which is just a MAT file underneath) so you can see what's in it. It sounds as though there are some absolute paths. A good reason, if any were needed, to avoid both fig and GUIDE!

Subject: Activating GUI calls wrong version of m file

From: Jeffery

Date: 30 Sep, 2010 15:11:05

Message: 5 of 12

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i827gp$n2a$1@fred.mathworks.com>...
> "Jeffery " <jmorin@evanshamilton.com> wrote in message <i826kh$n2p$1@fred.mathworks.com>...
> > Hi,
> > I'm working with the guide mechanism in Matlab to write a small calculator. Something rather odd developed when I accumulated multiple versions of the .fig and .m file in the directory.
> > Now when I try to activate the gui (say xxx_V4.fig) I get an error ("Reference to non-existent field" in xxx_V3. It doesn't matter if I move the V3 files to other directories, or delete the v3 files completely. Actually if I do this I get an error indicating that the Function V3 doesn't exist.
> > I guess my question is "Why is execution of the gui calling older m file versions?"
> > The matlabb version is 7.4.0 and I'm running Windows XP
> >
> > Thanks in Advance
> > Jeff
>
> Type:
> >>which your_mfile
> into the command line and see what it returns

Hi Sean,
Thanks for the reply. When I enter which xxx_V6.m the output gives me the path to the correct location for the .m file (C:\Jobs\DQM\TDScalculator_V6.m). This is the location of the .fig file.
A bit of a development. I got it working again (???) and am trying to debug. I've put a stop in the .m file at the beginning of variable assignment, but execution of the gui doesn't pause in the m file at the stop point. It's as if the .fig activation is calling a different version of the .m file (??)

Subject: Activating GUI calls wrong version of m file

From: ImageAnalyst

Date: 30 Sep, 2010 15:23:14

Message: 6 of 12

How are you making these new versions? I bet it all comes down to
that. You might not be able to just copy and paste in your operating
system and rename the files since there are some properties in the fig
file that won't get updated if you do only that.

Subject: Activating GUI calls wrong version of m file

From: Jeffery

Date: 30 Sep, 2010 15:48:06

Message: 7 of 12

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <712d7c7a-4c42-45f1-8444-61e30b5a7e7a@y3g2000vbm.googlegroups.com>...
> How are you making these new versions? I bet it all comes down to
> that. You might not be able to just copy and paste in your operating
> system and rename the files since there are some properties in the fig
> file that won't get updated if you do only that.


Hi,
I don't doubt that this might be the issue. I have generally opened the .fig file and m editor together. I have tried saving the .m file, saving the .fig file, saving both together. The changes I make to the .m file do not get saved (??)) I don't understand however why when I alter the .m file in the editor, then save in the editor, then start the gui from the command line (calling the .m file) the changes I've made to the m file still do not appear(??)

Thanks for the help.

Subject: Activating GUI calls wrong version of m file

From: Jeffery

Date: 30 Sep, 2010 15:54:21

Message: 8 of 12

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <9d2e5277-a985-4eb1-96c5-800ea27605d4@y31g2000vbt.googlegroups.com>...
> On Sep 30, 10:25 am, "Jeffery " <jmo...@evanshamilton.com> wrote:
> > Hi,
> > I'm working with the guide mechanism in Matlab to write a small calculator.  Something rather odd developed when I accumulated multiple versions of the .fig and .m file in the directory.  
> > Now when I try to activate the gui  (say xxx_V4.fig) I get an error ("Reference to non-existent field"  in xxx_V3.  It doesn't matter if I move the V3 files to other directories, or delete the v3 files completely.  Actually if I do this I get an error indicating that the Function V3 doesn't exist.  
> > I guess my question is "Why is execution of the gui calling older m file versions?"
> > The matlabb version is 7.4.0 and I'm running Windows XP
> >
> > Thanks in Advance
> > Jeff
>
> ----------------------------------------------
> Open your fig file in GUIDE.
> Double click the figure to open the property inspector.
> Look at the field for CreateFcn.

Hmmmm... Neither, there is no entry here. Silly, should there be?

Thanks for the help
> Does it say version 3 or version 4?

Subject: Activating GUI calls wrong version of m file

From: Jeffery

Date: 30 Sep, 2010 16:00:27

Message: 9 of 12

"Malcolm Lidierth" <ku.ca.lck@htreidil.mloclam> wrote in message <i828el$pnn$1@fred.mathworks.com>...
> z=load('filename.fig', '-mat')
> will let you inspect the contents of the figure file (which is just a MAT file underneath) so you can see what's in it. It sounds as though there are some absolute paths. A good reason, if any were needed, to avoid both fig and GUIDE!

Thanks for that. I'd like to share the sentiment, but alas....
The load command generates z which appears as a 1 x 1 struct.
at >z
I get :
hgS_070000: [1x1 struct].

and that's about it
I think I'm doing something wrong

Subject: Activating GUI calls wrong version of m file

From: Malcolm Lidierth

Date: 30 Sep, 2010 17:09:05

Message: 10 of 12

Now open z in the variable editor. You can navigate through it
like any other MATLAB variable.

Subject: Activating GUI calls wrong version of m file

From: Steven_Lord

Date: 30 Sep, 2010 17:49:14

Message: 11 of 12



"Jeffery " <jmorin@evanshamilton.com> wrote in message
news:i82bfm$ejc$1@fred.mathworks.com...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message
> <712d7c7a-4c42-45f1-8444-61e30b5a7e7a@y3g2000vbm.googlegroups.com>...
>> How are you making these new versions? I bet it all comes down to
>> that. You might not be able to just copy and paste in your operating
>> system and rename the files since there are some properties in the fig
>> file that won't get updated if you do only that.
>
>
> Hi,
> I don't doubt that this might be the issue. I have generally opened the
> .fig file and m editor together. I have tried saving the .m file, saving
> the .fig file, saving both together. The changes I make to the .m file do
> not get saved (??)) I don't understand however why when I alter the .m
> file in the editor, then save in the editor, then start the gui from the
> command line (calling the .m file) the changes I've made to the m file
> still do not appear(??)

Open the figure file (the newest version that works) in GUIDE. Use GUIDE's
File -> Save As menu item to save the file using the new name; this should
allow GUIDE to make the appropriate changes to the callback properties so
that they refer to the file with the new name.

http://www.mathworks.com/support/solutions/en/data/1-6OU4FE/?solution=1-6OU4FE

If you need to change the name of the GUI in the future, I recommend you use
this same procedure when you do so.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Activating GUI calls wrong version of m file

From: matt

Date: 10 Oct, 2012 23:11:08

Message: 12 of 12

Seen the same thing - here's how to fix it:

Your figure and your m file have become "disconnected" somehow. Here's how to link them again.

Go to GUIDE.
Select Tools - GUI Options
Make sure "GENERATE FIG-FILE AND M-FILE" is selected

You are good to go...

BE SURE TO SAVE YOUR FIGURE AND YOUR M FILE UNDER A SEPARATE NAME BEFORE RELINKING THEM!! This will save you a possible headache when you go to merge them. :)

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