5 - Basic Commands
MATLAB is an interactive program for numerical computation and data visualization. You can enter a command by typing it at the MATLAB prompt '>>' on the Command Window.
In this section, we will provide lists of commonly used general MATLAB commands.
Commands for Managing a Session
MATLAB provides various commands for managing a session. The following table provides all such commands −
Command | Purpose |
---|---|
clc | Clears command window. |
clear | Removes variables from memory. |
exist | Checks for existence of file or variable. |
global | Declares variables to be global. |
help | Searches for a help topic. |
lookfor | Searches help entries for a keyword. |
quit | Stops MATLAB. |
who | Lists current variables. |
whos | Lists current variables (long display). |
Commands for Working with the System
MATLAB provides various useful commands for working with the system, like saving the current work in the workspace as a file and loading the file later.
It also provides various commands for other system-related activities like, displaying date, listing files in the directory, displaying current directory, etc.
The following table displays some commonly used system-related commands −
Command | Purpose |
---|---|
cd | Changes current directory. |
date | Displays current date. |
delete | Deletes a file. |
diary | Switches on/off diary file recording. |
dir | Lists all files in current directory. |
load | Loads workspace variables from a file. |
path | Displays search path. |
pwd | Displays current directory. |
save | Saves workspace variables in a file. |
type | Displays contents of a file. |
what | Lists all MATLAB files in the current directory. |
wklread | Reads .wk1 spreadsheet file. |
Input and Output Commands
MATLAB provides the following input and output related commands −
Command | Purpose |
---|---|
disp | Displays contents of an array or string. |
fscanf | Read formatted data from a file. |
format | Controls screen-display format. |
fprintf | Performs formatted writes to screen or file. |
input | Displays prompts and waits for input. |
; | Suppresses screen printing. |
5 - Basic Commands
Reviewed by Usman Ibrahim
on
06:54
Rating:
No comments: