CS/NEUR125: Starting MATLAB
MATLAB desktop and interactive environment
Getting started:
On a Macintosh, start MATLAB by clicking on this icon:
How to find MATLAB on a Wellesley public computer:
- Macintosh:
- From the Go menu at the top of your screen, select Applications
- From within the Applications folder, find the icon labeled MATLAB_R2015b
(you may see a more recent version, which is ok)
- Double-click on this icon to start MATLAB
- PC:
- Click here for how to find MATLAB on a PC.
Important parts of your MATLAB screen:
- Command Window
(circled in red)
Where you type your commands
- Current Folder Window
(circled in blue) Allows access to current directory
- Workspace
(circled in magenta) Variables
are tracked here
Helpful tips:
-
Resize your MATLAB window by dragging the lower right corner
-
Restore your MATLAB window:
If your MATLAB window(s) somehow change appearance, you can always
restore the default setup by clicking on Layout in the top toolbar.
-
Reduce extra blank lines by typing format compact into your Command Window
- Use the
arrow keys:
Use the up- and down-arrow keys to cycle through past commands that were entered in the Command Window
and stored in the Command History. The left- and right-arrow keys help you to edit within a line.
-
Recycle
content from the Command History: you can also double-click a command in the Command History,
to run it again (faster and more accurate than re-typing!)
- Clear the Command Window by entering
clc in the Command Window
- Comments in your code:
% indicates a comment. MATLAB ignores
everything after the % sign. For example: %
CS/NEUR125 lab code is a comment. Note that comments in the
MATLAB editor appear green (but you can customize the MATLAB appearance).
- Set your Current directory/folder in MATLAB:
The Current Folder is where MATLAB reads files from and writes them to.
It is important that you have it set correctly in every working session. To
see what your Current Folder is at any point, look at the line above the
"Current Folder" window. In the picture below, the "Current Folder" is
Users/skakavou/Documents/MATLAB.
To change your Current Folder, click on the icons to the left of this bar,
or on the elements within it.
You can navigate to your Desktop, for example, and then into your desired folder.
- Exit out of MATLAB when done!
|