# Matlab Command Line

Let me tell you about the command line or interactive environment in Matlab.

**What is Matlab's interactive environment?** It's an interactive environment that allows you to use Matlab as a calculator. And it's located in the Command Window pane of the Matlab software.

So, when you open up the command line, you'll see this prompt symbol, represented by the double greater-than sign (>>), followed by a flashing cursor.

>>

That's where you can type in your commands.

For instance, type in the command 2+3 and press Enter.

>> 2+3

Matlab will process the command and display the result, which in this case is 5.

ans = 5

The expression "ans" is short for "answer."

And then it'll open up a new command line for you to use.

**Note**. The command line is based on the principle of REPL (Read Evaluate Print Loop). When you type a command and press Enter, Matlab reads the command you typed (Read), processes it (Evaluate), prints the result (Print), and returns to the command line prompt (Loop).

The cool thing is, Matlab keeps a **history of the commands** you've typed in memory.

So, if you need to use a command again, you can just press the UP and DOWN arrow keys on your keyboard to scroll through the list of commands you've used.

And if you forget the name of a command, no worries.

Just type in the first few letters you remember and press the **Tab key** on your keyboard. Matlab will list all the commands that begin with those letters.

For example, type "sin" and then press Tab.

>> sin

sin sinc sind sinetone sinewave single sinh

Matlab lists all the commands that begin with the letters "sin."

**But what if you don't remember the syntax of a command?**

Well, you can use Matlab's online help through the help function.

Just type in "help" followed by the name of the command you want to learn about.

For example, type **help sin**.

help sin

Matlab displays the syntax of the sin() command, providing you with all the necessary information.

To get more information about the command, you can also consult the documentation using the **doc** statement followed by the name of the command.

For example, type **doc sin**.

doc sin

In summary, mastering the command line in Matlab requires some patience and practice, but it's an essential skill for any Matlab user.