Type a command, press Enter, and MATLAB answers.
MATLAB opens with several panels. The practice window on the right copies the three you need first:
Your copy of MATLAB may arrange them differently. A fourth panel, the Editor, is where scripts are written. It shows up in lesson 7.
The >> in the Command Window is the prompt. It means MATLAB is waiting for you. Type a command after it, press Enter, and the answer appears below. Try these, either by typing them or with the Run buttons:
2 + 3 500 * 2 # 2 seconds of EEG recorded at 500 samples per second 10 / 4
MATLAB uses * for multiply, / for divide, and ^ for a power. It follows the usual order of operations, so add parentheses when you mean something else:
2 ^ 10 (0.1 + 30) / 2
When you calculate something without giving the result a name, MATLAB puts it in a variable called ans. Look at the Workspace: ans appeared there after your first command. Each new unnamed result replaces the old one, and you can use ans in the next command.
500 * 60 # samples in one minute at 500 Hz ans * 5 # samples in five minutes
ans is fine for a quick check. For anything you want to keep, give it a name of your own, which is the next lesson.
clc wipes the text in the Command Window. It only cleans the screen. Everything in the Workspace stays.
clc
Click in the command line and press the up arrow (↑) to bring back what you typed before. Press it again to go further back. You can edit the line before pressing Enter, which saves retyping a long command that had one typo.
When MATLAB cannot make sense of a command, it prints a message in red and does nothing else. Nothing is broken. Read the message, fix the line, and run it again.
5 + eegdata
The first is missing a number after the +. The second asks for something called eegdata, and MATLAB has no variable or function by that name. "Unrecognized function or variable" is the error you will see most. It almost always means a typo, a variable you have not made yet, or a function MATLAB cannot find (lesson 3).
Anything after a % is a comment. MATLAB skips it; it is there for the person reading.
500 * 2 % samples in two seconds
Each box ticks itself when you do it in the practice window. Stuck? "show me" puts a command in the window for you.
The MathWorks, Inc. (2025). MATLAB documentation. https://www.mathworks.com/help/matlab/