This preview shows pages 1–2. Sign up to view the full content.
3.1 Managing The MATLAB Workspace
A list of the current variables residing in the MATLAB Workspace is obtained by
typing the command '
who
' in the MATLAB Command window.
More detailed
information about the variables is acquired by typing '
whos
' instead.
Example 3.1.1
clear
x=5;y=10;
z=x+y*i;
A=pi*x^2;
who
Your variables are:
A
x
y
z
whos
Name
Size
Bytes
Class
A
1x1
8
double array
x
1x1
8
double array
y
1x1
8
double array
z
1x1
16
double array (complex)
Grand total is 4 elements using 40 bytes
Note that despite the fact that all four variables are scalars (3 real and 1 complex)
their size is listed as 1
×
1, reflecting the array orientation of MATLAB.
Also note that
numerical variables are stored in double precision using 8 bytes and belong to a class
(data type) referred to as
double
.
Later on other data types will be considered and
displayed using the '
whos
' command.
The Workspace Browser reveals the same
information and is accessible from the
File
menu
by selecting
Show Workspace
or by
selecting the
Workspace Browser
button on the Command window toolbar.
The '
clear
' command removes all variables from the MATLAB Workspace.
Specific variables, or a set of variables with a common characteristic, can be deleted by
appending an argument to the '
clear
' command as shown below.
It is good practice to
clear all variables from the Workspace whenever a new task is initiated.
Example 3.1.2
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '11
 klee

Click to edit the document details