Main Content

crop

Remove data from tireData object

Since R2024a

    Description

    example

    obj = crop(obj, criteria) removes tire data using the criteria specified by criteria from the tireData object specified by obj.

    Examples

    collapse all

    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

    collapse all

    Tire data, specified as a tireData object or an array of tireData objects.

    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 in tireData objects. The logical vector must be the same length as the data channel vectors in each tireData 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 the tireData 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

    collapse all

    Cropped tire data, returned as a tireData object or an array of tireData objects.

    Version History

    Introduced in R2024a

    See Also