MATLAB Functions
Commands by Subject
Help Desk

Elementary Matrices and Matrix Manipulation


Elementary Matrices and Arrays
eye Identity matrix
linspace Generate linearly spaced vectors
logspace Generate logarithmically spaced vectors
ones Create an array of all ones
rand Uniformly distributed random numbers and arrays
randn Normally distributed random numbers and arrays
zeros Create an array of all zeros
: (colon) Regularly spaced vector

Special Variables and Constants
ans The most recent answer
computer Identify the computer on which MATLAB is running
eps Floating-point relative accuracy
flops Count floating-point operations
i Imaginary unit
Inf Infinity
inputname Input argument name
j Imaginary unit
NaN Not-a-Number
nargin, nargout Number of function arguments
pi Ratio of a circle's circumference to its diameter,
realmax Largest positive floating-point number
realmin Smallest positive floating-point number
varargin, varargout varargin, varargout

Time and Dates
calendar Calendar
clock Current time as a date vector
cputime Elapsed CPU time
date Current date string
datenum Serial date number
datestr Date string format
datevec Date components
eomday End of month
etime Elapsed time
now Current date and time
tic, toc Stopwatch timer
weekday Day of the week

Matrix Manipulation
cat Concatenate arrays
diag Diagonal matrices and diagonals of a matrix
fliplr Flip matrices left-right
flipud Flip matrices up-down
repmat Replicate and tile an array
reshape Reshape array
rot90 Rotate matrix 90 degrees
tril Lower triangular part of a matrix
triu Upper triangular part of a matrix
: (colon) Index into array, rearrange array