Professional Documents
Culture Documents
dr.dcd.h CS 101 /SJC 5th Edition 1 dr.dcd.h CS 101 /SJC 5th Edition 2 dr.dcd.h CS 101 /SJC 5th Edition 3
dr.dcd.h CS 101 /SJC 5th Edition 4 dr.dcd.h CS 101 /SJC 5th Edition 5 dr.dcd.h CS 101 /SJC 5th Edition 6
1
The MATLAB Desktop2 The Command Window The Command Window2
A user can enter interactive commands at
the command prompt (>>) in the
command window.
A user can place a series of commands into
Command Window
a script file, and the entire file can be
executed by typing its name in the
command window.
MATLAB script files are also known as M-
files, because they have a file extension of
“.m”.
dr.dcd.h CS 101 /SJC 5th Edition 7 dr.dcd.h CS 101 /SJC 5th Edition 8 dr.dcd.h CS 101 /SJC 5th Edition 9
dr.dcd.h CS 101 /SJC 5th Edition 10 dr.dcd.h CS 101 /SJC 5th Edition 11 dr.dcd.h CS 101 /SJC 5th Edition 12
2
The Document Window The Document Window2 The Document Window3
It is also called Edit/Debug Window.
An Edit Window is created when you create
a new M-file or open an existing one.
There are several ways to open an editing
window:
Click the New Script icon
Click the New icon and then select Script
Type edit from the command window
dr.dcd.h CS 101 /SJC 5th Edition 13 dr.dcd.h CS 101 /SJC 5th Edition 14 dr.dcd.h CS 101 /SJC 5th Edition 15
dr.dcd.h CS 101 /SJC 5th Edition 16 dr.dcd.h CS 101 /SJC 5th Edition 17 dr.dcd.h CS 101 /SJC 5th Edition 18
3
Docking & Undocking Windows2 The MATLAB Workspace The MATLAB Workspace2
To undocking clicks the down-arrow icon to A workspace is the collection of all the The who andwhos commands.
the upper-right corner of a pane. variables and arrays that are defined within
the command window.
This window is also called the Workspace
Browser.
A list of variables and arrays in the currect
workspace can be generated with the who
or whos command.
dr.dcd.h CS 101 /SJC 5th Edition 19 dr.dcd.h CS 101 /SJC 5th Edition 20 dr.dcd.h CS 101 /SJC 5th Edition 21
dr.dcd.h CS 101 /SJC 5th Edition 22 dr.dcd.h CS 101 /SJC 5th Edition 23 dr.dcd.h CS 101 /SJC 5th Edition 24
4
Array Editor3 Current Folder Current Folder2
Also called the current directory. It allows the user to manipulate files
It shows all the files in the selected folder. interactively.
dr.dcd.h CS 101 /SJC 5th Edition 25 dr.dcd.h CS 101 /SJC 5th Edition 26 dr.dcd.h CS 101 /SJC 5th Edition 27
dr.dcd.h CS 101 /SJC 5th Edition 28 dr.dcd.h CS 101 /SJC 5th Edition 29 dr.dcd.h CS 101 /SJC 5th Edition 30
5
Useful Commands Useful Commands2 Useful Commands3
who Type demo in the command window. To find out where a command is located,
whos using the which command.
clear [var_list]
more on/off
Ctrl-C (or ^C)
clc (not cls)
clf
help command
lookfor keyword
demo
which command
dr.dcd.h CS 101 /SJC 5th Edition 31 dr.dcd.h CS 101 /SJC 5th Edition 32 dr.dcd.h CS 101 /SJC 5th Edition 33
dr.dcd.h CS 101 /SJC 5th Edition 34 dr.dcd.h CS 101 /SJC 5th Edition 35 dr.dcd.h CS 101 /SJC 5th Edition 36
6
Homework Assignment #1 How to Make Homework How to Make Homework2
1.6 Exercises Make sure your command window is under
Page 24: 1.1, 1.3, 1.4, 1.8, 1.9, 10 format compact;
This assignment is due by next week. Enter the homework questions line-by-line;
Late submission will be penalized. Copy and paste the outputs including the
Hand-written homework will not be commands into a word document and
accepted or graded. select the minimum spacing;
Hand in a hardcopy of your homework, no Save figures into image files and then
electronic submission will be accepted. insert them into your document. You may
need to change their sizes;
Print your homework to a nearby printer.
dr.dcd.h CS 101 /SJC 5th Edition 37 dr.dcd.h CS 101 /SJC 5th Edition 38 dr.dcd.h CS 101 /SJC 5th Edition 39
dr.dcd.h CS 101 /SJC 5th Edition 40 dr.dcd.h CS 101 /SJC 5th Edition 41