trimdata
Description
trims B
= trimdata(A
,m
)A
to size m
by removing elements from the
trailing side of A
. For example, for a scalar size m
:
If
A
is a vector, thentrimdata(A,m)
trimsA
to lengthm
.If
A
is a matrix, table, or timetable, thentrimdata(A,m)
trimsA
to havem
rows.If
A
is a multidimensional array, thentrimdata(A,m)
trimsA
to the size specified bym
along the first dimension whose size does not equal 1.
If m
is greater than or equal to the size of A
in
the operating dimension, then trimdata
returns all of
A
.
specifies additional parameters for trimming using one or more name-value arguments. For
example, B
= trimdata(A
,m
,Name=Value
)trimdata(A,m,Side="leading")
trims by removing elements from the
beginning of A
.
Examples
Input Arguments
Tips
trimdata
only removes elements from the input data.trimdata
is recommended if you do not want to add additional data and you do not require the resized data to match the target size. If you require the resized data to respect the specified sizes inm
, then consider using theresize
function, which can also add elements to your data.
Extended Capabilities
Version History
Introduced in R2023b