Main Content

Desktop Basics

When you start MATLAB®, the desktop appears in its default layout.

The desktop has three panels and a toolstrip with tabs labeled Home, Plots, and Apps.

The desktop includes these panels:

  • Current Folder— Access your files.

  • Command Window— Enter commands at the command line, indicated by the prompt (>>).

  • Workspace— Explore data that you create or import from files.

当你在MATLAB工作,你命令cre问题ate variables and call functions. For example, create a variable namedaby typing this statement at the command line:

a = 1

MATLAB adds variableato the workspace and displays the result in the Command Window.

a = 1

Create a few more variables.

b = 2
b = 2
c = a + b
c = 3
d = cos(a)
d = 0.5403

When you do not specify an output variable, MATLAB uses the variableans, short foranswer, to store the results of your calculation.

sin(a)
ans = 0.8415

If you end a statement with a semicolon, MATLAB performs the computation, but suppresses the display of output in the Command Window.

e = a*b;

You can recall previous commands by pressing the up- and down-arrow keys, ↑ and ↓. Press the arrow keys either at an empty command line or after you type the first few characters of a command. For example, to recall the commandb = 2, typeb, and then press the up-arrow key.