MATLAB Function Reference Previous page   Next Page

Operators and Operations

Special Characters

: Specify range of array elements
( ) Pass function arguments, or prioritize operations
[ ] Construct array
{ } Construct cell array
. Decimal point, or structure field separator
... Continue statement to next line
, Array row element separator
; Array column element separator
% Insert comment line into code
! Issue command to operating system
= Assignment

Arithmetic Operations

+ Plus
- Minus
. Decimal point
= Assignment
* Matrix multiplication
/ Matrix right division
\ Matrix left division
^ Matrix power
' Matrix transpose
.* Array multiplication (element-wise)
./ Array right division (element-wise)
.\ Array left division (element-wise)
.^ Array power (element-wise)
.' Array transpose

Bit-wise Operations

bitand Return bit-wise AND
bitcmp Return bit-wise complement
bitget Get bit at specified position
bitmax Return maximum double-precision floating-point integer
bitor Return bit-wise OR
bitset Set bit at specified position
bitshift Shift bits specified number of places
bitxor Return bit-wise XOR

Relational Operations

< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
== Equal to
~= Not equal to

Logical Operations

&& Logical AND
|| Logical OR
& Logical AND for arrays
| Logical OR for arrays
~ Logical NOT
all Determine if all array elements are nonzero
any Determine if any array elements are nonzero
false Return logical 0 (false)
find Find indices and values of nonzero elements
is* Detect state
isa Determine if input is object of given class
iskeyword Determine if string is MATLAB keyword
isvarname Determine if string is valid variable name
logical Convert numeric values to logical
true Return logical 1 (true)
xor Logical exclusive-OR

Set Operations

intersect Find set intersection of two vectors
ismember Detect members of set
setdiff Find set difference of two vectors
issorted Determine if set elements are in sorted order
setxor Find set exclusive OR of two vectors
union Find set union of two vectors
unique Find unique elements of vector

Date and Time Operations

addtodate Modify date number by field
calendar Display calendar for specified month
clock Return current time as date vector
cputime Return elapsed CPU time
date Return current date string
datenum Convert date and time to serial date number
datestr Convert date and time to string format
datevec Convert date and time to vector of components
eomday Return last day of month
etime Return time elapsed between date vectors
now Return current date and time
tic, toc Measure performance using stopwatch timer
weekday Return day of week

Previous page  Arrays Programming in MATLAB Next page

© 1994-2005 The MathWorks, Inc.