Import Data to Test a Discrete Algorithm

Specify a Signal-Only Structure

To import data for a discrete signal, specify a signal-only structure as the input value. Do not specify a time vector.

Example of Importing Data to Test a Discrete Algorithm

  1. Set the sample time for the Inport, Trigger, or From Workspace block.

  2. For the data that you want to import, specify a structure variable that does not include a time vector. For example, for the variable called import_var:

    import_var.time = [];
    import_var.signals.values = [0; 1; 5; 8; 10];
    import_var.signals.dimension = 1;

    The input for the first time step is read from the first element of an input port value array. The value for the second time step is read from the second element of the value array, and so on.

    For details about how to specify the signal value and dimension data, see Specify Signal Data.

  3. In the block parameters dialog box for the block that imports the data, clear the Interpolate data parameter.

  4. If you are using a From Workspace block to import data, set the Form output after final data value by parameter to a value other than Extrapolation.

Was this topic helpful?