Javatpoint Logo
Javatpoint Logo

MATLAB Commands

MATLAB is an interactive program for numerical computing and data visualization. We can enter a command by typing it at the MATLAB prompt '>>' on the Command Window.

In this topic, we will provide lists of frequently used general MATLAB commands.

On-Line help

Commands Purpose
help lists topics on which help is available
helpwin opens the interactive help window
helpdesk Opens the web-browser-based help facility
help topic provide help on the topic
lookfor string lists help topics containing a string
demo runs the demo program
lookfor Keyword search for help
doc Online HTML documentation
whatsnew Display ReadMe files
info Info about MATLAB
syntax Help on command syntax
why Give a philosophical device
format Set screen output format
more Control paged screen output
home Send cursor home
echo Echo commands in the script file
↑,↓ Recall previous commands
global Declare variables to be global

Variable and Workspace Information

Commands Purpose
who lists variables currently in the workspace
whos lists variables directly in the workspace with their size
what lists M-, Mat-, and Mex directories on the disk
clear clear the workspace, and all variables are removed
clear x, y, z clear only variables x, y, and z.
clear all Clears all variables and function from workspace
mlock fun locks function fun so that clear cannot delete it
munlock fun unlocks functions fun so that clear cannot remove it
clc clears command window, cursor shift to the top
home scrolls the command window, cursor moves to the top
clf clear figure window
load Load variable from file
save Save variable in Mat-file
length Length of a vector
size Size of a matrix
pack Consolidate memory space
disp Display text or matrix

Working with Files and Directory Information

Commands Purpose
pwd shows the current working directory
cd changes the current working directory
dir lists contents of the current directory
ls lists contents of the current files, same as dir
path gets or sets MATLAB search path
editpath modifies MATLAB search path
copyfile copies a file
mkdir creates a new directory
rmdir Remove directory
delete Delete file
diary Save text of MATLAB session
type Show contents of the file
! Access operating system
path List accessible directories
what Lists all MATLAB data in the current directory.
wklread Reads .wk1 spreadsheet file.

General Information

Commands Purpose
computer tells you the computer type you are using
clock gives you wall clock time and date as a vector
date tells you the date as a string
more control the paged output according to the screen size
ver gives the license and the MATLAB version data
bench benchmarks our computer on running MATLAB compared to other devices

Start and Exist

Commands Purpose
^c(Control-c) local abort, kills the current command execution
matlabarc Master start-up file
startup M-file executed at start-up
quit Quit MATLAB
exit same as quit

Time and Date

Commands Purpose
clock Wall clock time
cputime Elapsed CPU time
date Date, month, year
etime Elapsed time function
tic Start stopwatch timer
toc Read stopwatch timer

Next TopicMATLAB Environment





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA