I have a simple question about matlab GUI?
how can i Enable some component visibility in MATLAB GUI figure? For an easy understanding i am using a fgure to explain my problem.
I wanted to do something like.
After Running my Gui. i wanted to show only a specific pushbutton rather all the components
as shown in Figure 1
Once i click on Lets ADD Button the figure 2 should appear
After selecting a number my Other Components should appear as shown in figure 3.
Sorry if my Words are misleading to you as i do not have a good command on technical words.
Thanks..........
You need to detect the event (i.e. press button) and create a function for that.
There you will need to enable the visibility of whatever you want like:
set(handles.pushbutton1,'visible','on')
Related
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.
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 want to display my output messages that have processes in a function. The message is stored in a variable.
In the GUI window, I made an uipanel with tag=uipanel1.
So, my question is how do I display my messages in the specified uipanel that I made (uipanel1)?
Any ideas?
There are many ways to do this, but it is hard to guess the most appropriate way without some information on what you already tried. I would suggest the following options:
If your uipanel is not high and is used much like statusbar in gui applications then you better add a static text component to it and update its text through its handle.
While static test can also display multiline text it will not display scrollbars. If you want to display something like a message log window with several lines visible and scroll bars, I'd suggest to add a listbox instead. However, it will be a little tricky if you want to show only limited number of most resent messages.
I have a list of names in a listbox. What I would like to do is have a certain selected name change color, from red to green, when I click a button.
Thank you
It is not supported officially. There are non-documented features that do it - check out http://www.undocumentedmatlab.com.
You might have already solved this, but I thought I would clarify Andrey just a bit. MATLAB GUI components can handle HTML in their properties. So, I imagine setting up your button callback to edit the properties of your listbox using HTML to change the color would be an appropriate way to proceed here. Yair Altman has a pretty good write up here: http://undocumentedmatlab.com/blog/html-support-in-matlab-uicomponents/
Granted, that example is simple, but you should be able to adapt it to fit your needs if I have understood your question correctly.
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.