# MATLAB Programming/Workspace

[MATLAB Programming\|/MATLAB Programming]m]
Chapter 1: MATLAB ._.
    Fundamentals of MATLAB
    MATLAB Workspace
    MATLAB Variables
    *.mat files
Chapter 2: MATLAB Concepts
    MATLAB operator
    Data File I/O
Chapter 3: Variable Manipulation
    Numbers and Booleans
    Strings
    Portable Functions
    Complex Numbers
Chapter 4: Vector and matrices
    Vector and Matrices
    Special Matrices
    Operation on Vectors
    Operation on Matrices
    Sparse Matrices
Chapter 5: Array
    Arrays
    Introduction to array operations
    Vectors and Basic Vector Operations
    Mathematics with Vectors and Matrices
    Struct Arrays
    Cell Arrays
Chapter 6: Graphical Plotting
    Basic Graphics Commands
    Plot
    Polar Plot
    Semilogx or Semilogy
    Loglog
    Bode Plot
    Nichols Plot
    Nyquist Plot
Chapter 7: M File Programming
    Scripts
    Comments
    The Input Function
    Control Flow
    Loops and Branches
    Error Messages
    Debugging M Files
Chapter 8: Advanced Topics
    Numerical Manipulation
    Advanced File I/O
    Object Oriented Programming
    Applications and Examples
    Toolboxes and Extensions
Chapter 9: Bonus chapters
    MATLAB Benefits and Caveats
    Alternatives to MATLAB
    [MATLAB_Programming/GNU_Octave|What is Octave= (8) hsrmonic functions]
    Octave/MATLAB differences

## MATLAB Workspace

MATLAB has a programming environment in its own and needs an area to store the variables and other program data that is stored while using the tool. MATLAB has a command window as shown, and a base workspace which is the default workspace. Functions in MATLAB also have their own workspace, and the visibility of a variable is dependent on the workspace that it resides in. If the variable is in the base workspace then it is visible to all of the scripts and functions in MATLAB, while a function's local variables are visible to that function only and are not usable outside that function.
Type this on the MATLAB Command Window
You will see
as a response, also note that there would also be an addition to the Base workspace.
To check out what all variables are stored in the MATLAB workspace, we can use the following command.
This would list out all the variables currently present in the MATLAB workspace, but would not give much idea about the data types and the size of the variables, to have those in the result use this command instead
By this time, i think there would be much clutter on your command window.
To clear out all the output on the command window, use this command.
This WOULD NOT clear out the variables and the history. so that you would have a new clean and fresh command window.
The output of whos on my screen showed something like this
Now, if you notice the Size is marked as 1X1, but why? The reason for this is that in MATLAB all the data is realized as double precision arrays (well, its the way MATLAB is designed to work as it is a scientific computing tool). And so scalars like these are realized as a 1X1 array. Simple!
After all this if you think your work is done and you do not need all those variables in the MATLAB workspace now, you can relieve yourself of your Programmers baggage by using this command.
This clears out any and all variables in the workspace. But if your miseries are not yet to finish and would like to remove a variable or two.
where var1, var2, var3,.... are the variables that you want to clear, do not put the three dots in the end, that's just for description.