Programming |
Summary of Matrix and Array Functions
This section summarizes the principal functions used in creating and handling matrices. Most of these functions work on multidimensional arrays as well.
Function |
Description |
[a,b] or [a;b] |
Create a matrix from specified elements, or concatenate matrices together. |
accumarray |
Construct a matrix using accumulation. |
blkdiag |
Construct a block diagonal matrix. |
cat |
Concatenate matrices along the specified dimension. |
diag |
Create a diagonal matrix from a vector. |
horzcat |
Concatenate matrices horizontally. |
magic |
Create a square matrix with rows, columns, and diagonals that add up to the same number. |
ones |
Create a matrix of all ones. |
rand |
Create a matrix of uniformly distributed random numbers. |
repmat |
Create a new matrix by replicating or tiling another. |
vertcat |
Concatenate two or more matrices vertically. |
zeros |
Create a matrix of all zeros. |
Function |
Description |
ctranspose |
Flip a matrix about the main diagonal and replace each element with its complex conjugate. |
flipdim |
Flip a matrix along the specified dimension. |
fliplr |
Flip a matrix about a vertical axis. |
flipud |
Flip a matrix about a horizontal axis. |
reshape |
Change the dimensions of a matrix. |
rot90 |
Rotate a matrix by 90 degrees. |
transpose |
Flip a matrix about the main diagonal. |
Function |
Description |
isempty |
Return tru e for 0-by-0 or 0-by-n matrices. |
isscalar |
Return true for 1-by-1 matrices. |
issparse |
Return true for sparse matrices. |
isvector |
Return true for 1-by-n matrices. |
length |
Return the length of a vector. |
ndims |
Return the number of dimensions in a matrix. |
numel |
Return the number of elements in a matrix. |
size |
Return the size of each dimension. |
Function |
Description |
iscell |
Return true if the matrix is a cell array. |
ischar |
Return true if matrix elements are characters or strings. |
isfloat |
Determine if input is a floating point array. |
isinteger |
Determine if input is an integer array. |
islogical |
Return true if matrix elements are logicals. |
isnumeric |
Return true if matrix elements are numeric. |
isreal |
Return true if matrix elements are real numbers. |
isstruct |
Return true if matrix elements are MATLAB structures. |
Function |
Description |
circshift |
Circularly shift matrix contents. |
issorted |
Return true if the matrix elements are sorted. |
sort |
Sort elements in ascending or descending order. |
sortrows |
Sort rows in ascending order. |
Function |
Description |
blkdiag |
Construct a block diagonal matrix. |
diag |
Return the diagonals of a matrix. |
trace |
Compute the sum of the elements on the main diagonal. |
tril |
Return the lower triangular part of a matrix. |
triu |
Return the upper triangular part of a matrix. |
Function |
Description |
ind2sub |
Convert a linear index to a row-column index. |
sub2ind |
Convert a row-column index to a linear index. |
Function |
Description |
|
Concatenate arrays. |
|
Shift array circularly. |
|
Inverse permute array dimensions. |
|
Generate arrays for n -dimensional functions and interpolation. |
|
Return the number of array dimensions. |
|
Permute array dimensions. |
|
Shift array dimensions. |
|
Remove singleton dimensions. |
Multidimensional Structure Arrays | Data Types |
© 1994-2005 The MathWorks, Inc.