The command window provides flexibility to MATLAB and how users interact with your programs. It is the place where you can issue a single line of code to be executed by MATLAB. You can issue any command that is a valid line of MATLAB code. The command window is a unique feature of MATLAB and is an invaluable tool for debugging programs, testing functions, making quick calculations, and more.
In your career, you will often use the Command Window for quick calculations or to check your work (in essence turning it into a very expensive calculator). For example, lets say that you are working on a problem and need to convert 15.23 degrees to radians. You remember the conversion factor is \(\frac{\pi\text{ rad}}{180^\circ}\text{,}\) and when you calculate it by hand you get \(15.23 \text{ degrees} = 0.27 \text{ radians}\text{.}\)You want to check your answer in MATLAB and you remember that MATLAB has a built-in function to automatically convert a number from degrees to radians (deg2rad()). So you quickly type the following in the command window (see Example 8.3.2). Voila! You were right. Don’t panic yet! I don’t expect you to know the function deg2rad() yet, I am just showing an example of how to use the command window.