Page 39 -
P. 39

x=1;y=2;
                                save 'user volume:x'
                                save 'user volume:workspace'

                              The first save command saved the variable x into a file x.mat. You can
                             change the name of the .mat file so it does not match the variable name, but
                             that would be confusing. The second command saves all variables (x and y)
                             in the workspace into workspace.mat.
                              To load x.mat and workspace.mat, enter MATLAB and use the MATLAB
                             load functions; note what you obtain if you entered the following commands:

                                load 'user volume:x'
                                x
                                load 'user volume:workspace'
                                y
                              After loading the variables, you can see a list of all the variables in your
                             workplace if you enter the MATLAB who command.
                              What would you obtain if you had typed and entered the who command at
                             this point?
                              Now, to clear the workspace of some or all variables, use the MATLAB
                             clear function.

                                clear x %clears variable x from the workspace
                                clear     %clears all variables from workspace






                             1.12 MATLAB Commands Review

                             axis                Sets the axis limits for both 2-D and 3-D plots. Axis
                                                  supports the arguments equal and square, which
                                                  makes the current graphs aspect ratio 1.
                             contour             Plots contour lines of a surface.
                             clear               Clears all variables from the workspace.
                             clf                 Clears figure.
                             for                 Runs a sequence of commands a given number of
                                                  times.
                             getframe            Returns the pixel image of a movie frame.
                             help                Online help.
                             hold on(off)        Holds the plot axis with existing graphics on, so that
                                                  multiple figures can be plotted on the same graph
                                                  (release the hold of the axes).



                             © 2001 by CRC Press LLC
   34   35   36   37   38   39   40   41   42   43   44