In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of figure in MATLAB_GUI. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Elements in the MATLAB GUI window
As shown in the following figure:
Elements in the GUI interface in the next few issues, I will introduce the window figure one by one
To make an interface, the first thing to bear the brunt is the window, we have to create a window, and then we can add all kinds of things to this window, which is equivalent to a container. So how do you create a window?
H_fig = figure
The h_fig returned is the handle to the created window. If you don't understand what the handle is, think of it as a container. H_fig is the name we gave to the window we just created. In this window container, we can add the controls we want to add.
Create a simple window, as shown in the following figure:
Common properties of element windows in the GUI interface
But it's too easy like this. Usually we need to set some properties of the window, so how do we look at the properties of the window? Type h_fig enter on the command line of matlab, and this h_fig is the one written above. If you don't have the above sentence, you can't type this directly. This will display all the properties of the window on the command line, but it will not be displayed all at once. You need to click on all the properties, as shown in the following figure:
Attribute
Here is a list of commonly used properties:
Color can set the color of the window
MenuBar is usually used to turn off the default menu bar
Name is used to set the title of the window
NumberTitle, turn off the number of the window.
Position sets the location of the window
Resize sets whether the window can be resized by stretching
ToolBar is usually used to turn off the default toolbar
Units sets the units of the Position coordinates of the window
Visible sets whether the window is visible
There are some window callback functions that I haven't listed. I don't think the interfaces in the general setup can be used. Generally, these are enough. If you need relevant functions, please follow the above method of obtaining attributes, and guess which one may be what you want according to the names of those attributes, and then go to the MATLAB documentation to see the instructions.
How to get the property values of a window
Now that you know what attributes there are, how do you check the property values of a certain property of the window? take getting the property values of Units as an example:
On the command line of matlab, enter:
Set (h_fig, 'Units')
When you enter, you can see those property values. This method can be used not only for figure but also for other controls later, as long as you want to get the property values of a graphic handle.
Gets the property value of the property value settings window
If you need to set multiple property values at once, you can set them in the following ways:
Window handle. Attribute name = attribute value; remember: this method requires the first letter of each word that makes up the attribute name to be capitalized. This method of setting property values applies to all controls that will be discussed later.
H_fig = figure
H_fig.NumberTitle = 'off';% close the numeric title
H_fig.Name = 'tutorial 1 (figure)';% window name is tutorial 1 (figure)
H_fig.MenuBar = 'none';% turn off figure's default menu bar
H_fig.ToolBar = 'none';% turn off the default toolbar for figure
H_fig.Color = 'knight;% black
% Units must be set before Position
H_fig.Units = 'pixels';% pixels
H_fig.Position = [0,0,900,100]; the lower left corner is 900 pixels wide and 100 pixels high in the lower left corner of the screen.
H_fig.Resize = 'off'
H_fig.Visible = 'on';% is hidden if it is off, not visible
The running results are as follows:
With regard to Position, the general unit takes the value of pixels: pixel, Position. Please try more for yourself to figure it out.
Window handle. Attribute name = attribute value; it also has an equivalent way:
Set (window handle, 'property name', property value)
For example:
Set (h_fig, 'Units',' pixels');% pixels in units
Set (h_fig, 'Position', [0,0,900,100]); the lower left corner is 900 pixels wide and 100 pixels high in the lower left corner of the screen.
This approach does not require the first letter of every word that makes up the attribute name to be capitalized, but all lowercase. This method of setting property values applies to all controls that will be discussed later.
However, if you only need to set one or two properties, the following method is recommended:
H_fig = figure ('attribute 1,' value 1, 'attribute 2,' value 2, 'attribute 3, value 3')
For example:
H_fig = figure ('Name',' tutorial 1 (figure)', 'MenuBar',' none', 'ToolBar',' none')
This is the end of this article on "sample Analysis of figure in MATLAB_GUI". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.