Data Cursor Problem wtih Alt-Click

조회 수: 5 (최근 30일)
Mel
Mel 2011년 6월 2일
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
Mel
Mel 2011년 6월 2일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Richard
Richard 2011년 6월 6일
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
Mel
Mel 2011년 6월 6일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Richard
Richard 2011년 6월 2일
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
Richard
Richard 2011년 6월 2일
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 2011년 6월 5일
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?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by