MATLAB: Data Cursor Problem wtih Alt-Click

gui

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?

Best Answer

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.