0
0
MATLABdata~5 mins

MATLAB Desktop and Command Window

Choose your learning style9 modes available
Introduction

The MATLAB Desktop is your workspace where you can write and run commands. The Command Window is where you type commands and see results immediately.

You want to quickly test a math calculation.
You need to run a script or function and see the output.
You want to explore variables and data interactively.
You want to debug code by running commands step-by-step.
You want to manage files and folders related to your project.
Syntax
MATLAB
>> command

% Example: >> a = 5 + 3
The '>>' symbol is the prompt where you type commands in the Command Window.
Press Enter to run the command and see the result below.
Examples
Assign values to variables and add them. The result of z will show below.
MATLAB
>> x = 10
>> y = 20
>> z = x + y
Display a message in the Command Window.
MATLAB
>> disp('Hello, MATLAB!')
List all variables currently in the workspace.
MATLAB
>> who
Sample Program

This program assigns numbers to x and y, adds them, and shows the result as a message.

MATLAB
% Simple commands in MATLAB Command Window
x = 7;
y = 3;
sum_val = x + y;
disp(['Sum of x and y is: ', num2str(sum_val)])
OutputSuccess
Important Notes

You can use the Command Window to try small pieces of code before writing full scripts.

The MATLAB Desktop also has other useful panels like Workspace and Editor to help organize your work.

Use the up and down arrow keys in the Command Window to cycle through previous commands.

Summary

The MATLAB Desktop is your main working area.

The Command Window lets you type commands and see results immediately.

Use it to test ideas, run code, and explore data interactively.