Code covered by the BSD License  

Highlights from
CreateMatrixFromModelData

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.79 KB File ID: #26555

CreateMatrixFromModelData

by Mike Anthony

 

01 Feb 2010 (Updated 02 Feb 2010)

Outputs a matrix of doubles containing the data from signals logged in Simulink.

| Watch this File

File Information
Description

CreateMatrixFromModelData
Mike Anthony
Mark McBroom
Copyright 2010 The MathWorks, Inc.

This is a recursive function takes any of the following data objects commonly associated with data logging in Simulink:
  Simulink.ModelDataLogs
  Simulink.SubsysDataLogs
  Simulink.ScopeDataLogs
  Simulink.TsArray
  Simulink Timeseries

This function outputs an nxm matrix of type double where:
  n = length of the timeseries data
  m = number of timeseries in the input (if the input is a
      Timeseries, m = 1).

output_matrix = CreateMatrixFromModelData(inputTsArray)

This function is particularly useful in conjunction with bus signals, signal logging, and the Limit Check element in SystemTest. When signal logging is enabled for a bus signal in Simulink, the data is saved as a Simulink.TsArray. As of R2009b, the Limit Check Element in SystemTest only supports native Simulink data types. The matrix output of this function is fully compatible with the Limit Check element. As such, this provides a quick way to compare bus signals in the limit check element.

This function works well along with the functions in the acknowledgments section.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Example: Creating TimeSeries and TsArray Inputs for Simulink Bus Signal Input Data, Create Bus Data for Models with Root-Level Bus Inputs

Required Products Simulink
MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
02 Feb 2010

Change of file and function name and corresponding comments.

Tag Activity for this File
Tag Applied By Date/Time
data export Mike Anthony 02 Feb 2010 11:08:14
bus signal Mike Anthony 02 Feb 2010 11:08:14
simulink Mike Anthony 02 Feb 2010 11:08:14
bus Mike Anthony 02 Feb 2010 11:08:14
data import Mike Anthony 02 Feb 2010 11:08:14
signal logging Mike Anthony 02 Feb 2010 11:08:14
tsarray Mike Anthony 02 Feb 2010 11:08:14
timeseries Mike Anthony 02 Feb 2010 11:08:14

Contact us at files@mathworks.com