Thread Subject: gui .m file referencing functions in older version instead of own

Subject: gui .m file referencing functions in older version instead of own

From: scott

Date: 20 Jun, 2009 11:09:02

Message: 1 of 7

I made a gui using guide (call it mygui with .m file mygui.m) and then revised it and called it mygui2 (with .m file mygui2.m). However, when I run mygui2, instead of calling its own functions, it calls functions from mygui (which are called the same thing). For some reason, it is not giving its own namespace priority. I don't have much experience putting multiple functions in a single .m file, so I don't know whether this is just what matlab does, but it would seem intuitive to give the functions in one's own .m file priority.

Other than the easy but annoying fix of naming all the functions differently (although I haven't tried this to make sure it would work), is there anything else to be done?
Thanks,
Scott

version: 2007b
os: win

Subject: gui .m file referencing functions in older version instead of own

From: Bruno Luong

Date: 20 Jun, 2009 11:33:01

Message: 2 of 7

"scott" <grenblau@yahoo.deletethis.com> wrote in message <h1ig0e$s6k$1@fred.mathworks.com>...
> I made a gui using guide (call it mygui with .m file mygui.m) and then revised it and called it mygui2 (with .m file mygui2.m). However, when I run mygui2, instead of calling its own functions, it calls functions from mygui (which are called the same thing). For some reason, it is not giving its own namespace priority. I don't have much experience putting multiple functions in a single .m file, so I don't know whether this is just what matlab does, but it would seem intuitive to give the functions in one's own .m file priority.
>
> Other than the easy but annoying fix of naming all the functions differently (although I haven't tried this to make sure it would work), is there anything else to be done?
> Thanks,
> Scott

The "cause" probably does not lie on your mfile but the associated fig file. Each graphic object has its own callback property and probably they are still refering to the inner function of mygui(). It's usually not recommend to "revise" a GUI file, whatever "revise" mean.

Bruni

Subject: gui .m file referencing functions in older version instead of own

From: Nathan

Date: 20 Jun, 2009 17:54:15

Message: 3 of 7

On Jun 20, 4:09 am, "scott" <grenb...@yahoo.deletethis.com> wrote:
> I made a gui using guide (call it mygui with .m file mygui.m) and then revised it and called it mygui2 (with .m file mygui2.m).  However, when I run mygui2, instead of calling its own functions, it calls functions from mygui (which are called the same thing).  For some reason, it is not giving its own namespace priority.  I don't have much experience putting multiple functions in a single .m file, so I don't know whether this is just what matlab does, but it would seem intuitive to give the functions in one's own .m file priority.
>
> Other than the easy but annoying fix of naming all the functions differently (although I haven't tried this to make sure it would work), is there anything else to be done?
> Thanks,
> Scott
>
> version: 2007b
> os: win

What you would want to do instead is save the .fig file as mygui2, it
will automatically name the new .m file accordingly and fix and
linking issues.
This has happened to me too, and that's what solved it.
Good luck
-Nathan

Subject: gui .m file referencing functions in older version instead of own

From: scott

Date: 22 Jun, 2009 03:50:01

Message: 4 of 7

Nathan <ngreco32@gmail.com> wrote in message <0ad1b602-3b0b-4d4a-b819-d30be043ae1b@y10g2000prc.googlegroups.com>...
> On Jun 20, 4:09?am, "scott" <grenb...@yahoo.deletethis.com> wrote:
> > I made a gui using guide (call it mygui with .m file mygui.m) and then revised it and called it mygui2 (with .m file mygui2.m). ?However, when I run mygui2, instead of calling its own functions, it calls functions from mygui (which are called the same thing). ?For some reason, it is not giving its own namespace priority. ?I don't have much experience putting multiple functions in a single .m file, so I don't know whether this is just what matlab does, but it would seem intuitive to give the functions in one's own .m file priority.
> >
> > Other than the easy but annoying fix of naming all the functions differently (although I haven't tried this to make sure it would work), is there anything else to be done?
> > Thanks,
> > Scott
> >
> > version: 2007b
> > os: win
>
> What you would want to do instead is save the .fig file as mygui2, it
> will automatically name the new .m file accordingly and fix and
> linking issues.
> This has happened to me too, and that's what solved it.
> Good luck
> -Nathan


Thanks for your suggestion. I did this, but am still getting the problem.

Subject: gui .m file referencing functions in older version instead of own

From: scott

Date: 22 Jun, 2009 03:57:00

Message: 5 of 7

For example, here is an error message from the following situation.

I had a .fig file named fixSpotCalls.fig
I generated fixSpotCalls.m from it.
I edited fixSpotCalls.fig to fixSpotCallsRFOnly.fig and generated a new .m file called fixSpotCallsRFOnly.m

Then I ran fixSpotCallsRFOnly and here is the error messasge when trying to create one of the ui controls.

---------------
q=fixSpotCallsRFOnly('tmr','001',w);
??? Undefined function or method 'fixSpotCalls' for input arguments of type 'char'.

Error in ==> @(hObject,eventdata)fixSpotCalls('spotContextSlider_CreateFcn',hObject,eventdata,guidata(hObject))


??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn
-------------------------
In the properties for this uicontrol, however, I have the following under createfcn:

fixSpotCallsRFOnly('spotContextSlider_CreateFcn',gcbo,[],guidata(gcbo))

which is correct.



Thanks,
Scott

Subject: gui .m file referencing functions in older version instead of own

From: scott

Date: 22 Jun, 2009 03:59:03

Message: 6 of 7

One more thing I forgot to mention. The reason it gave me an error in createfcn is because I renamed the old fixSpotCalls.fig and fixSpotCalls.m files to something else so that they could no longer be found. This exposed the embedded dependence upon those files in my new fixSpotCallsRFOnly.m/fig files

Subject: gui .m file referencing functions in older version instead of own

From: Bruno Luong

Date: 22 Jun, 2009 06:19:01

Message: 7 of 7

"scott" <grenblau@yahoo.deletethis.com> wrote in message <h1mvi7$bk$1@fred.mathworks.com>...
> One more thing I forgot to mention. The reason it gave me an error in createfcn is because I renamed the old fixSpotCalls.fig and fixSpotCalls.m files to something else so that they could no longer be found. This exposed the embedded dependence upon those files in my new fixSpotCallsRFOnly.m/fig files

Take a look of the CALLBACK in your fig, as we suggested.

Bruno

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
gui scott 20 Jun, 2009 07:14:02
guide scott 20 Jun, 2009 07:14:02
functions scott 20 Jun, 2009 07:14:02
namespace scott 20 Jun, 2009 07:14:02
rssFeed for this Thread
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com