2.1. The MATLAB Development Environment¶
The MATLAB integrated development environment (IDE) is conducive for rapid program development. It consists of the following.
- MATLAB Desktop: This typically contains five subwindows: the Command Window, the Workspace Browser, the Current Directory Window , the Command History Window, and one or more Figure Windows, which are visible when the user displays a graphic, such as a plot.
- MATLAB Editor: This is used to create and edit M-files. It includes a number of useful functions for saving, viewing, and debugging M-files.
- Help System: This includes the Help Browser, which displays HTML documents and contains a number of search and display options.
The interaction between the Command Window, Workspace Browser, and the Editor make a convenient environment for software development.
In the command window, one may interactively type commands. Simple calculations may be entered using only the command window. It is also nice for testing commands and syntax before adding those commands to a file in the editor.
Variable values and data size can be viewed either from the command window or the workspace browser.
In the editor, one can type code into scripts and functions so that they will be saved for future use.
When writing a script file, commands in the script can be run as though they were typed in the command window.
The debugger can be used to set breakpoints to stop the execution at set places. With the execution stopped, one can use the command window to determine what changes are needed to fix a problem.
The profiler can be used to improve the performance of larger programs by measuring where the program the spends the most time.
2.1.1. How to get help¶
MATLAB provides an extensive set of commands and functions to ease the programmer’s task. So finding documentation is critical to being successful. MATLAB provides three simple mechanisms to find the information that you need.
- Use the help tool from the Command Window. For example to learn about the disp function type
help disp
.- Near the upper right corner of the MATLAB development environment is an input box labeled Search Documentation. Type anything that you want more information about in this box and select from the list of available documents. The information found will usually be more detailed than given by the help tool from the Command Window. It will often include useful examples.
- The same documentation available from the built-in search tool can be found on MathWorks’ web pages. Using your web browser and favorite Internet search engine, just prepend the word MATLAB to what you are looking for.
2.1.2. Options for using MATLAB¶
- Use K-State’s MATLAB floating licenses from campus lab computers.
- A student license is fairly affordable. With a student license, you also have access to MATLAB Online and MATLAB Mobile. MATLAB Online allows access to MATLAB from any Internet connected computer.
These options will be discussed in class.