MATLAB Function Reference

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 ! 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 Bit-wise AND bitcmp Bit-wise complement bitor Bit-wise OR bitmax Maximum floating-point integer bitset Set bit at specified position bitshift Bit-wise shift bitget Get bit at specified position bitxor 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 Test to determine if all elements are nonzero any Test for any nonzero elements false False array find Find indices and values of nonzero elements is* Detect state isa Detect 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 True array xor Logical EXCLUSIVE OR

Set Operations

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

Date and Time Operations

 calendar Calendar for specified month clock Current time as date vector cputime Elapsed CPU time date Current date string datenum Serial date number datestr Convert serial date number to string datevec Date components eomday End of month etime Elapsed time now Current date and time tic, toc Stopwatch timer weekday Day of the week

 Arrays Programming in MATLAB