Lab 1. Part 2.
MATLAB intro
How to find MATLAB on a Wellesley public computer:- Macintosh:
- Click on the Spotlight (magnifying glass icon) in the Mac menu bar upper right corner.
- Type "MATLAB". It will suggest MATLAB_2017a
. - Double-click the MATLAB_2017a icon
- PC:
- From the Search programs and files box, type in "MATLAB".
- Select the MATLAB version (it will likely be more recent that the 2012a version shown above)
- From the Search programs and files box, type in "MATLAB".
Important parts of your MATLAB screen:
- Current Folder Window
(circled in blue)
Allows access to current directory - Command Window
(circled in red)
Where you type your commands - Workspace
(circled in magenta)
Variables (more on this later) are tracked here
-
Resize your MATLAB window via the lower right corner
-
Restore your MATLAB window
If your MATLAB windows somehow change their appearance, you can always restore the default setup by clicking on on the top tool bar. -
Reduce extra blank lines
By typing format compact into your Command Window - Use the
arrow keys
Use the up-arrow key to get the command history. The left and right-arrow keys can help you edit within a line.
-
Recycle
content from Command History pop up
You can double-click a command in the Command History pop up, to run it again (faster and more accurate than re-typing!). This video shows how to re-execute commands from the pop-up command history window. - Clear the command window
clc clears the command window - Comments in your code
-
% indicates a comment. MATLAB ignores
everything after the % sign. For example:
% CS112 Lab 1
is a comment. Note that comments in the MATLAB editor appear green (but you can customize the MATLAB appearance).
-
% indicates a comment. MATLAB ignores
everything after the % sign. For example: