Data Cursor Problem wtih Alt-Click

1 visualizzazione (ultimi 30 giorni)
Mel
Mel il 2 Giu 2011
In the past I have always used the Alt-Click to add extra cursors without need to right click and select 'add new cursor'. I made some recent modifications to my code and now I get errors when I use the Alt-Click method. But the code runs perfectly if I use the longer method of right clicking. Any reason for this sudden and strange behaviour in a GUI?
  1 Commento
Mel
Mel il 2 Giu 2011
This is the error:
??? Error using ==> feval
Undefined function or method 'FileMenu_Callback' for
input arguments of type 'struct'.
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> Seg_gui at 45
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)Seg_gui('FileMenu_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uimenu Callback

Accedi per commentare.

Risposta accettata

Richard
Richard il 6 Giu 2011
Mel, I can reproduce the error by doing the following:
  1. Start GUIDE
  2. Add a menu item, label it "File" and give it the tag "FileMenu"
  3. Save the GUI to "Seg_gui.fig"
  4. Edit the Seg_gui.m file and remove the function "FileMenu_Callback"
  5. Run the GUI and press Alt.
This now causes the error, and it is due to the graphical menu object having a callback set, but that callback not existing in the Seg_gui.m file.
To fix the error you can either manually add a function of that name back into the Seg_gui.m file (just copy one of the other callback function lines and change the name), or you can edit the GUI in GUIDE again to completely remove the callback on that menu:
  1. Open Seg_gui in GUIDE.
  2. Go to Tools->Menu Editor.
  3. Select the File menu.
  4. In the Callback text box, delete all the text. This will remove the callback.
  5. Press OK on the Menu Editor.
  6. Save the gui.
  1 Commento
Mel
Mel il 6 Giu 2011
Thank you so much. For some reason adding the following one liners worked. function FileMenu_Callback(hObject, eventdata, handles). I am still unsure about how this error came about because there are no objects with the Tag 'FileMenu' in the GUI when I opened GUIDE.

Accedi per commentare.

Più risposte (1)

Richard
Richard il 2 Giu 2011
Mel, At a glance this doesn't look like it can be directly caused by data cursors: it looks like a missing function in your gui function Seg_gui. If you post your actual code maybe we can make more sense of it.
Richard
  3 Commenti
Richard
Richard il 2 Giu 2011
OK, that explains some part of the error: when you press Alt, the first menus is selecting, and I think the callback of that top-level menu is being executed. Does your GUI have menus? Do you create them in your code?
These questions could be answered if we can see -maybe even part of - your code. The error message clearly indicates that the error happens in Seg_gui. Is Seg_gui your code?
Mel
Mel il 5 Giu 2011
Seg_gui is my gui code. And yes there is menu in the GUI to choose the data for the desired position (3 positions to choose from in a drop down menu). This menu was created using GUIDE (gui guide). Is there any way to include a line in the code to ignore this error or do you know why this error is being generated?

Accedi per commentare.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by