GUI error in non-existing gui item

Hello,
Running MATLAB R2016B on Windows 10
I am currently creating my first GUI with Matlab. It was all working fairly well, until I deleted some items from the .fig in guide. Now my code GUI.m code still contains all the deleted items that have ever existed in the GUI.fig. I tried deleting them since it takes up about 600 lines of code and they don't even exist in the .fig file. However, when I try to run the GUI I get the following error: Undefined function or variable 'edit1_CreateFcn'.
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in GUI (line 43) gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GUI('edit1_CreateFcn',hObject,eventdata,guidata(hObject))
I have attached my code and the .fig file. I have commented out all the functions for items that do not exist in the .fig. If I want to get rid of all my errors I would have to leave all that code in.
Hope someone knows what I am doing wrong here. Thanks!

 Accepted Answer

Image Analyst
Image Analyst on 23 Apr 2017
You erroneously commented out the edit1 create function at line 328 but you are still using the edit field control in the :Input file" panel as you can see in GUIDE. Put the code back in.

4 Comments

Sander Voss
Sander Voss on 23 Apr 2017
Edited: Sander Voss on 23 Apr 2017
Ah you are right, that was stupid. Fixed it but now I get the same error for edit45, of which I am really pretty sure does not appear in the .fig anywhere.
The sec field in the GMSTo panel has a callback that refers to edit45. Click the icon in the Property inspector for that field to make the callback automatic. It will tell you that you have manually modified it (to edit45) but just say OK to blow away the bad one and let it automatically put in the correct callback. You might want to check all your other edit fields to to make sure the name in the Callback property matches the "tag" property.
Yes that's it, wow thank you! I spent ages trying to find where edit45 was being mentioned. Was there an easy way to find that or did you just have to open all the items and check the callback? Anyways, thanks so much!
I double clicked on controls on the figure and looked at the callback functions, which is usually where the problems lie, until I found one that said edit45. I started with edit fields, then after inspecting a few edit fields, I found the culprit.

Sign in to comment.

More Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!