[ Team LiB ] Previous Section Next Section

M1.3 The MATLAB Workspace

We can view the variables currently in the Workspace by typing


» who
Your variables are:
ans       x         y         z
leaving 621420 bytes of memory free.

More detail about the size of the matrices can be obtained by typing whos.

We can find the size of a matrix or vector by typing


» [m,n]=size(x)
m =
     1
n =
     6

where m represents the number of rows and n represents the number of columns.

If we do not put place arguments for the rows and columns, we find


» size(x)
ans =
     1     6

Since x is a vector, we can also use the length command


» length(x)
ans =
     6

It should be noted that MATLAB is case sensitive with respect to variable names. An X matrix can coexist with an x matrix.

Sometimes it is desirable to clear all of the variables in a Workspace. This is done by simply entering


» clear

in the command window. More frequently you may wish to clear a particular variable, such as x


» clear x

This is particularly true if you are performing a new calculation of x and the new vector is shorter than the old vector. If the new vector has length n, then all of the elements of the new x greater than x(n) will contain values of the previous x vector.

    [ Team LiB ] Previous Section Next Section