Wednesday, February 22, 2012

GUI in MATLAB 3

Last time we played with a figure handle and changed location/size of the window.

Now let's see what else is there.

Let's start with the usual.
Then try additional stuff that start with "set(F1,..."

Now the toolbar and menubar are gone and the figure background changed color to yellow.

What "set" does is changing the "properties" of the object. In the above example, "set" changes the figure's (it knows which figure it's changing because you said F1 there.) color, toolbar status, and menubar status.
Color is in normalized [Red Green Blue] array. [1 1 1] means white and [0 0 0] means black. Of course you can try [0.3 0.5 0.7] for your color. Since it's normalized [1.5 1 1] won't work.

That's right. It's pretty cool.

Do you wonder what else you can change? There are two ways to check. "set" and "get".
"set(F1)" will tell you all the property names, current property values, and other choices for the property values.
"get(F1)" gives you simply the property names and current values.

That's enough of playing with figures for now.
We'll make some plots next time. After the plot is covered we can put buttons and custom menus on the figure to make it real GUI.

No comments:

Post a Comment