Array Operations¶
cell¶
Syntax
cell
cell(dimensions…)
Description
Returns a cell array containing empty matrices. A cell array can contain data of mixed types and sizes.
- If
dimensionsare provided, they must contain non-negative integers supplying the dimensions of the cell array to be returned. - If called with a scalar,
cell(n), this operator will return a squaren x ncell array filled with empty matrices. - When called with no arguments, this function returns the result of
cell(1). - The dimensions to a cell array must be concrete.
horzcat¶
Syntax
horzcat(a1,a2,…,an)
Description
Concatenate arrays a1,a2,…,an, horizontally, provided that all
input arrays have the same number of rows. Symbolic inputs are
permitted. If the input arrays contain unlike types, they will be
combined as specified in the order of precedence below. If one of the
input arrays is a
- function handle, then the result will be a function handle.
- struct array, then the result will be a struct array.
- cell array, then the result will also be a cell array.
- char array, then the result will also be a char array.
- numeric array and the left-most occurance has type
- double, then the result will also have type double.
- intN, then the result will also have type intN.
- uintN, then the result will also have type uintN.
- logical array, then the result is also a logical array.
vertcat¶
Syntax
vertcat(a1,a2,…,an)
Description
Concatenate arrays a1,a2,…,an, vertically, provided that all input
arrays have the same number of columns. Symbolic inputs are
permitted. If the input arrays contain unlike types, they will be
combined as specified in the order of precedence below. If one of the
input arrays is a
- function handle, then the result will be a function handle.
- struct array, then the result will be a struct array.
- cell array, then the result will also be a cell array.
- char array, then the result will also be a char array.
- numeric array and the left-most occurance has type
- double, then the result will also have type double.
- intN, then the result will also have type intN.
- uintN, then the result will also have type uintN.
- logical array, then the result is also a logical array.
length¶
Syntax
length(x)
Description
Returns the length of the largest dimension of input x. In other
words, length(x) = max(size(x)). Symbolic inputs are permitted.
setdiff¶
Syntax
setdiff(x,y)
Description
Returns the array elements in x that do not appear in array
y. The input arrays to setdiff are expected to share the same
type and may either be char or double arrays.
.. Does not accept symbolic inputs.
size¶
Syntax
d = size(x)
[d1,…,dn] = size(x)
size(x,dim)
Description
Gives the dimensions of the input array x.
- When called with a single argument
size(x)returns a vector,d, where each element is the size of a particular dimension inx. The length ofdis equal to the number of dimensions inx. - If an output vector,
[d1,…,dn], is given, thensize(x)stores the size of each dimension ofxin the variablesd1,…,dn. The elementdicontains the size of the dimensioniinx.- Suppose the number of dimensions,
m, inxis greater than the number of provided output variablesn. Thendiequals the size of theithdimension ofxfor0 < i < n. The last element,dn, is the product of the sizes of the remaining dimensions ofx, i.e. dimensionsnthroughm. - Suppose the number of dimensions,
m, inxis less than the number of provided output variablesn. Thendi = 1one for those extra dimensions wherem < i <= n.
- Suppose the number of dimensions,
- When called with two arguments,
size(x,dim), returns the size of the dimension ofxgiven by the concrete positive integerdim.
squeeze¶
Syntax
squeeze(x)
Description
Returns a new array with all same elements as x but with all of
the singleton dimensions removed. For example, if x had size [1
2 1 5 1] then size(squeeze(x)) = [2 5]. This operation accepts
arrays with symbolic inputs.
ctranspose¶
Syntax
x'
ctranspose(x)
Description
The complex conjugate transpose operation will return a matrix with
the elements in the rows and columns of x interchanged. The sign of the
imaginary part of any complex numbers will become negated.
- The input
xmay either be a vector or a 2D array. Additionally, it accepts arrays with symbolic elements.
transpose¶
Syntax
x.'
transpose(x)
Description
The nonconjugate transpose operation will return a matrix with the
elements in the rows and columns of x interchanged. The sign of
the imaginary part of any complex numbers will be left unchanged.
- The input
xmay either be a vector or a 2D array. Additionally, it accepts arrays with symbolic elements.