Main Content

Matrices and Arrays

Array creation, combining, reshaping, rearranging, and indexing

Matrices and arrays are the fundamental representation of information and data in MATLAB®. You can create common arrays and grids, combine existing arrays, manipulate an array's shape and content, and use indexing to access array elements. For an overview of matrix and array manipulation, watch Working with Arrays.

Funktionen

alle erweitern

zerosErstellen eines ausschließlich aus Nullen bestehenden Arrays
onesCreate array of all ones
randUniformly distributed random numbers
trueLogical 1 (true)
falseLogical 0 (false)
eyeIdentity matrix
diagCreate diagonal matrix or get diagonal elements of matrix
blkdiagBlock diagonal matrix
catVerknüpfen von Arrays
horzcatConcatenate arrays horizontally
vertcatConcatenate arrays vertically
repelemRepeat copies of array elements
repmatWiederholen von Kopien eines Arrays
combinationsGenerate all element combinations of arrays (Seit R2023a)
linspaceGenerieren eines Vektors mit Werten in linearen Abständen
logspaceGenerate logarithmically spaced vector
freqspaceFrequency spacing for frequency response
meshgridZwei- und dreidimensionale Raster
ndgridRectangular grid in N-D space
lengthLänge der größten Array-Dimension
sizeArray-Größe
ndimsNumber of array dimensions
numelAnzahl von Array-Elementen
isscalarDetermine whether input is scalar
isvectorDetermine whether input is vector
ismatrixDetermine whether input is matrix
isrowDetermine if input is row vector
iscolumnDetermine if input is column vector
isemptyDetermine whether array is empty
issortedDetermine if array is sorted
issortedrowsDetermine if matrix or table rows are sorted
isuniformDetermine if vector is uniformly spaced (Seit R2022b)

Resize

headGet top rows of array or table
tailGet bottom rows of array or table
resizeResize data by adding or removing elements (Seit R2023b)
paddataPad data by adding elements (Seit R2023b)
trimdataTrim data by removing elements (Seit R2023b)

Reshape

permutePermutieren von Array-Dimensionen
ipermuteInverse permute array dimensions
shiftdimShift array dimensions
reshapeUmformen eines Arrays durch Neuanordnung vorhandener Elemente
squeezeEntfernen von Dimensionen der Länge 1

Rearrange

sortSort array elements
sortrowsSort rows of matrix or table
flipSpiegeln einer Elementreihenfolge
fliplrFlip array left to right
flipudFlip array up to down
rot90Rotate array 90 degrees
transposeTransponieren eines Vektors oder einer Matrix
ctransposeComplex conjugate transpose
circshiftShift array circularly
colonVector creation, array subscripting, and for-loop iteration
endTerminate block of code or indicate last array index
ind2subConvert linear indices to subscripts
sub2indConvert subscripts to linear indices

Themen