CS112: Lab 1 :: Introduction to MATLAB
MATLAB desktop and interactive environment
On a Macintosh, start MATLAB by clicking on this icon:
How to find MATLAB on a Wellesley public computer:
- From the Go menu at the top of your screen, select Applications
- From within the Applications folder, find the icon labeled MATLAB_R2014a
- Double-click on this icon to start MATLAB
- 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
(circled in magenta)
Variables (more on this later) are tracked here
Download the lab1 folder from cs112 download directory
First, we'll use Fetch to connect to the CS server.
Make sure that SFTP is selected from the drop-down menu (outlined above in purple).
Directions for Fetch are here.
For documentation using WinSCP on a PC, click
Connect to the cs server using your own user name and password.
Then, use the
Path button on the Fetch window, to navigate to the root
of the file system (/), and then down to
where you will find the material available for downloading.
This is where you will find
files that you need for labs and assignments throughout the semester.
Download a copy of the lab1_programs folder
onto your desktop.
Rename the folder to be yours, e.g. stella_lab1_programs.
:: Helpful hints ::
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
Use the up-arrow key to get the command history. The left and right-arrow keys can help you edit within a line.
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!)
- 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).
Let's work with MATLAB now:
- MATLAB Practice
- Exploring MATLAB's help
Uploading your saved work
We'll use Fetch again, but this time you will access your own personal
account and password.
This time, login to Fetch using your username (the one you used when filling out the
account request form, probably the same username as your wellesley username).
- Browse through your account, finding the drop/assign# folders
- Learn how to delete a file from your account
- Upload your xxx_lab1_programs folder from your Desktop into your personal cs112 account
- When done uploading, be sure to delete your
xxx_lab1_programs folder from the desktop
(by putting it in the trash can) and then empty the trash (Finder--> Empty Trash).
- Exit out of MATLAB when done