MATLAB: GUIDE "Save Figure" toolbar button - matlab

I created a Gui in GUIDE and added the predefined "Save" toolbar button in guide->tools->toolbar. When i press the save button, the next time i open the GUI it will show the saved values and axes.
Now i would like to remove that feature again, but only removing the save button doesn't seem to work. The Gui still opens with the last saved values.
Is there a way to clear the saved data?

It appears that no further answers are forthcoming, and since I just ran across the same issue, this is what I did.
Open the object browser and determine which ones changed;
In my case it changed two text boxes as well as the axes.
Open the properties inspector for the changed objects and edit as required to return them
to their original states. I replaced the string property with the correct values.
It's too difficult to figure out how to make the axes object revert to it's old state. You can create a 2nd temporary axes and copy those states to the first axes; but I found this doesn't work. Instead, delete the old axes, create a new axes in it's place, and rename the tag to match the original. If there are any callbacks, make sure they're in the right place and delete the old one.
That's it. Good luck.

Related

Matlab guide starts with axes already plotted

I created an application using GUIDE called (main). Inside the form (figure), i dragged and dropped many components, one of them is an axes component. When i run the application, it shows allways the same plot. GUIDE generated applications have an opening function, in my case, main_OpeningFcn. I already tried to clear (cla) it in the first line of main_OpeningFcn function, but it first blinks and old plot and then clears it. I am sure it is an old plot, i can recognize it. It seems like this old plot had been saved somewhere and everytime the application starts, it is shown. Is there any cache or something like that?
Maybe you accidently clicked on the save icon in your figure from the gui-window (not guide-window). Now when you open your gui, matlab will not create an empty plot, but will load whatever is saved in the fig-file, that exists beside the m-file for your guide-application.
To solve the issue, you need to delete the figure in your guide-editor, an place a new figure instead. And try to hide the menubar to avoid clicking the save icon again, if your gui is open.

Non-existing picture appearing on table of contents

I'm having a problem with a Microsoft Word document. My document has at least 60 pictures that's why I have a table of contents for all those pictures. Recently I have replaced one of the images and now the table of contents is showing a reference to a picture that does not exist in the document. I can't find it anywhere.
This is what is happening. I have a reference to a Figure 11 that does not exist. I've already updated the entire document references and still no luck. I've also hold the Ctrl button and clicked on the reference which leads to nowhere. Just for the record, I have the track changes setting on.
Does anyone know how to fix this?
Ok guys I've realized that this problem was realated to the Track Changes setting being on. Since MS Word was keeping track of all changes, when removing a picture you need to Right Click the area where that removal happened and press Accept Removal.

Drag and drop from gef viewer to editor

I have a ScrollingGraphicalViewer containing a list of figures, let's call them "group figures", representing some business objects with relations between them. Each "group figure" may contain some other figures which are related. There are edit parts for every "group figure".
I want to be able to drag and drop any figure from the viewer into another editor. Right now, the viewer has a drag listener extending an AbstractTransferDragSourceListener class. Inside the listener, we get the viewer selection which is a corresponding EditPart of the selected group figure.
When there are many figures in the viewer and the vertical scrolling appears, I'm not able to detect the exact figure I dragged, based on the drag event and figure coordinates. How can I obtain the dragged figure?
There is a GEF tutorial on DnD. Here is is: https://eclipse.org/articles/Article-GEF-dnd/GEF-dnd.html
You can assume that you're dragging selected editparts I guess. Also you should set the transfer data for DnDing staff outside the viewer. The transfer data should most likely be the model object or image of the figure.
If you're DnDing not selected editparts then you'd have to figure out what exactly you're dragging from the mosule location coordinates at the drag start. Use viewer's
#findObjectAtExcluding(Point location, Collection exclusionSet, Conditional conditional)
method to find editpart under mouse. From the found editpart you can either get or the figure to set the appropriate transfer data.

Make an image a button in MATLAB

I am developing a GUI in MATLAB and am trying to allow a user to click on an image in order to enable a push button, and then this image will change like a toggle button, but I am struggling and am hoping for some advice, how can this be done?
I've seen that you can put icons on push buttons in MATLAB and that you can extract the position of the mouse on a click, but I can't figure out if these help my situation. I don't want to put the icon on the button because a) its not the look I am going for and b) I want to be able to change the image depending on the state of the button.
Thanks
The key to your problem is ButtonDownFcn. You need to set your images ButtonDownFcn to reference come function which both changes the image displayed, and does whatever else you need it to do. So, for example, say your create you image in you operating function like so:
...
yourImHandle = image(someImage);
set(yourImHandle, 'ButtonDownFcn', {#yourPushbuttonFcn, yourImHandle, otherVar});
...
Where yourPushbuttonFcn is defined elsewhere as:
function yourPushbuttonFcn(yourImageHandle, otherVar)
set(yourImageHandle, 'CData', someOtherImage);
otherVar=otherVar+1; %# Do other things.
end
This will change the image for you, and sets up the platform for you to do other, more complicated things inside the push button function. Let me know if you have any questions.
Good Luck.

I have a few GUI's in MATLAB and I need to view them in different tabs

I have 3 GUI files created using GUIDE. I need to have a tab Panel where I can view all of them in different tabs.
There is no straightforward way to accomplish that. A figure cannot be displayed inside another figure. GUIDE creates figure. You can convert your GUIDE figure to programmatical GUI by using some conversion procedure. There is one official by Mathworks, or other ones on file exchange. Then, you should place the 3 figures children inside a panel each.
There is no tab object in MATLAB. You can generate your own by making your own graphical objects: the tab buttons, that users can click to run a function that puts the right "tab" in front using uistack to change the order of your graphical objects, always bringing the clicked tab to the front.
But you would do this all in one GUI, in one figure window; you just not to make sure that hold is on in the figure, and you have to give all your plots a handle so that you can manipulate them with uistack.