Skip to main content
Logo image

Section 1.3 The MATLAB Windows

When you first start MATLAB, you will see this window:
Starting Matlab
Figure 1.4. Starting Matlab

Subsection 1.3.1 MATLAB Command Window

The Command Window is the main window of Matlab. Commands are typed into this window and interpreted by MATLAB:
  • >> 
    
    is the command prompt, that is the place where you can enter commands for MATLAB to execute.
  • As soon as you hit ’enter’, the command you just typed is executed (well, mostly. It gets a bit more complicated once we get to programming but for but for now think of MATLAB as simply a fancy graphing calculator).
    • Try it out right now: type 3 + 5 and hit enter.
  • Several commands can be typed on a single line by separating them with commas (think ; in C…)
    • Try it out right now: type 3+5, 4+6 and hit enter.
  • Use the up (\(\uparrow\)) and down (\(\downarrow\)) arrows to reissue previous commands, without having to retype them.
    • Try it out ….
  • Continue long lines with ellipsis (…) - watch out for spaces!
    • Try it out: type 3+..., hit enter, type 5 and hit enter.
  • The semicolon (;) prevents the output of your command from being echoed to the command window. This may seem useless right now, but just trust me: you’ll need this later.
  • The percent symbol (%) indicates a comment, which will become useful when writing programs in MATLAB.
  • clc clears the command window.
Command Window
Figure 1.5. Command Window

Subsection 1.3.2 More Windows

The Command History window displays a log of statements that you ran in the current and previous MATLAB sessions, along with information as to when you ran that command. You can simply double click on a command in the history window and it’ll get executed again. Or you can drag it over to the command window (in case you want to make edits, for example.) A colored mark precedes each statement that generated an error.
Command History
Figure 1.6. Command History
The Workspace window shows you all of the variables and other objects that are in use during your current session. We haven’t used any variables yet, but as soon as we do you’ll see the value of this window. Whereas in C we had to use printf() statements to monitor the values of variables in your code, the Worskape window allows you to keep track of variables without any extra work required.
Workspace
Figure 1.7. Workspace
MATLAB comes with a huge Online Help ecosystem. To access this help system, simply click on the question mark.
Online Help
Figure 1.8. Online Help
Within the help system you can find lots of manuals on everything you can think of.

Activity 1.1.

Go to the online help in MATLAB and try to search for an example named "teapot". If you find the example, try to open up the code in your MATLAB window. Can you even figure out how to run the code?
MATLAB Manuals
Figure 1.9. MATLAB Manuals
And finally, MATLAB comes with lots of demo code. Can you find a demo named “teapot”? If so, open up the code in your MATLAB windows. Can you even figure out how to run the code?
MATLAB Demos
Figure 1.10. MATLAB Demos