Question

I have measurement data that is stored in form of hierarchical structures containing MATLAB timeseries objects. For example:

MyData
  - TimeSeries1
  - TimeSeries2
  - MyHierarchicalData
     -- TimeSeries3

To use those in Simulink I use a from file block that reads these structures from a single file. However, to select signals out of those, the bus selector block needs a corresponding bus object. As the bus object more or less corresponds to the structure, I would like to know whether it is possible to generate a bus object out of my structured timeseries data. If the bus only contained a few variables, doing this by hand would not be a problem but the bus contains roughly 250 elements.

My first guess would be the Simulink API but I thought this problem occured more frequently and there exists an easier solution. If there is none and I am on the wrong trail I would appreciate some feedback as well.

Thanks in advance!

Was it helpful?

Solution

You can refer the answer that I posted to my own (somewhat similar) question: https://stackoverflow.com/a/17152383/1710688

Since you already have a structure of timeseries objects you need to use the function fieldnames (see MATLAB Documentation) to get values for each timeseries object. You have hierarchical structure so you will also need to use the function class (see MATLAB Documentation) to check if it is a timeseries object or a struct object in which case you need to again look at its fieldnames. I am not exactly sure on how to create a hierarchical signal bus object but hopefully this link on Using Bus Objects can help.

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top