Graduate School Forum
Learn more about graduate school information
1. Help: The Most Effective Command
Actually, I can say that without MATLAB software, I think I would basically know nothing. Whenever I encounter a problem, my first reaction is usually: help. Let me share some common methods of using help.
(1) Directly typing “help” in the command window will give you basic help information about MATLAB on your local machine.
(2) For some commands that are not very clear, if you only know the general category, for example, a certain toolbox, you can directly type “help toolboxname” in the command window to get information related to this toolbox: version number, function names, etc.
(3) If you know the function name, just use “help funname” to get the corresponding help information.
2. See Also: Don’t Underestimate the Related Commands
When using the help command, it’s possible that our initial direction may not be completely correct, and the help information listed does not directly provide what we are looking for. However, we must not overlook the “see also” section at the end of the help.
For example, I once encountered a problem of drawing an ellipsoid. At first, I thought this command function should be provided in graph3d (by the way, when using help, we can see MATLAB\graph3d – Three dimensional graphs). So, I used “help graph3d” but unfortunately, I did not find the function for drawing ellipsoids in Elementary 3-D plots. However, I found “SPECGRAPH” in the see also section. With a try-it-and-see attitude, I used “help specgraph” and found the function “ellipsoid – Generate ellipsoid” in Solid modeling.
3. Lookfor: Google in MATLAB
When we have no clue at all, we can seek help from it, which often yields unexpected results. For example, during GUI programming, I encountered a problem where I wanted to display a rectangle while dragging the mouse, just like the dashed rectangle that appears when you drag the mouse on the desktop. At first, I had no idea what to search for, but later I remembered to use it. So, I typed “lookfor Rectangle” and indeed, I found this information: “GETRECT Select rectangle with mouse.”
4. Get, Set: Helpers for GUI Object Properties
In GUI programming, we sometimes want to change certain object properties or implement them according to our ideas, but we may not remember these object properties, let alone how to set their values. At this point, we can use “get(handles)” to obtain all the properties and their current values of this object. Using “set(handles)” allows us to obtain all the properties that can be set for the object and their possible values. Once we find the property names and possible values we need, we can use “get(handles, ‘propertyname’)” to retrieve the value of this property and “set(handles, ‘propertyname’, values)” to set the value of this property for the object.
5. Edit: Assistant for Viewing M Source Files
During the use of MATLAB, we may want to see its M source files. Of course, we can open them using the editor, but I often directly use “edit funname.m” in the command window to avoid the hassle of locating the file.
6. Other Common Commands: Which, What, etc.
Which: Locate specified functions and files, preferably with the parameter -all to display more information; What: Get a list of M files, MEX files, and MAT file names in a specified directory.
For original experience posts, please contact the forum assistant