crop
Description
This function requires Extended Tire Features for Vehicle Dynamics Blockset.
Examples
Crop Imported Tire Data
Use the crop
function to remove tire data from tireData
objects using these input criteria options:
Logical vector
Numeric vector
MATLAB® expression
Import and View Tire Measurement Data
Import tire measurement data into a tireData
object, td
.
td = tireData("example_data.tdx");
Multiple Fz
conditions are included in the data. Use the split
function to separate the data by elapsed time et
, resulting in eight tireData
objects.
td = split(td,"et");
Use the plot
function to view the lateral force versus the slip angle using the normal force to assign colors and legend values.
plot(td, DataVariableNames=["alpha","Fy"],ColorBy="Fz");
Crop Data Using Logical Vector
Create a logical vector using true
values to indicate the indices of the data to remove. The logical vector must be the same length as the data channel vectors in each tireData
object.
tf = false(length(td(1).alpha),1); tf(end-19:end) = true;
Use the crop
function to remove the data at the indices indicated by the logical vector tf
.
tdCrop = crop(td,tf);
Plot Result
Plot the resulting tireData
objects in tdCrop
to visualize the modified data set.
plot(tdCrop,DataVariableNames=["alpha","Fy"],ColorBy="Fz");
Crop Data Using Numeric Vector
Create a numeric vector using integer values to indicate the indices of the data to remove.
idx = find(tf);
Use the crop
function to remove the data at the indices indicated by the integer vector idx
.
tdCrop = crop(td,idx);
Plot Result
Plot the resulting tireData
objects in tdCrop
to visualize the modified data set.
plot(tdCrop,DataVariableNames=["alpha","Fy"],ColorBy="Fz");
Crop Data Using MATLAB Expression
Create a MATLAB expression string using data channel names to define the data to crop. This approach is useful when arrays of tireData
objects have various lengths for data channels.
expression = "abs(alpha) > deg2rad(10)";
Use the crop
function to remove the data that results in the MATLAB expression expression
evaluating to true
.
tdCrop = crop(td,expression);
Plot Result
Plot the resulting tireData
objects in tdCrop
to visualize the modified data set.
plot(tdCrop,DataVariableNames=["alpha","Fy"],ColorBy="Fz");
Input Arguments
obj
— Tire data
tireData
object | array of tireData
objects
Tire data, specified as a tireData
object or an array of
tireData
objects.
criteria
— Criteria to remove tire data
logical vector | integer vector | string scalar
Criteria to remove tire data, specified as one of these values:
Logical vector —
true
values indicate the indices to remove from the data channel vectors intireData
objects. The logical vector must be the same length as the data channel vectors in eachtireData
object.Integer vector — Integer values indicate the indices to remove from the data channel vectors in
tireData
objects.String scalar — Provide a MATLAB expression using tire data channels. Data that results in the MATLAB expression evaluating to
true
is removed. Tire data channels must be a property of thetireData
object. See tireData Properties.
Example: "abs(alpha)>deg2rad(10)"
crops all tire data where the
absolute value of alpha
is less than
0
.
Note
You cannot define workspace variables as a string in the criteria input. To use
workspace variable values, concatenate the criteria string with the variable value
prior to executing the crop
function.
Data Types: int8
| int16
| int32
| int64
| logical
| string
Output Arguments
obj
— Cropped tire data
tireData
object | array of tireData
objects
Cropped tire data, returned as a tireData
object or an array of
tireData
objects.
Version History
Introduced in R2024a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)