Azzera filtri
Azzera filtri

Is there a way to export model explorer information to Excel?

23 visualizzazioni (ultimi 30 giorni)
I would like to export my Simulink model's data dictionary information that is captured in the model explorer to a spreadsheet. I there a way to do this?

Risposta accettata

Louis Lintereur
Louis Lintereur il 22 Ago 2013
Thanks to Mathworks trainer, Scott Cowan, for providing the following answer via email:
Simulink Report Generator product facilitates that very task. However, without Simulink Report Generator, you’ll be forced to use the Stateflow API to programmatically access the data dictionary… and then use MATLAB functions to export the information, e.g., to Excel. Open the Simulink model that contains the desired Stateflow data dictionary, and then invoke the following MATLAB commands:
% Access the handle to the root Simulink model
s = slroot
% Access the Stateflow Chart block in that Simulink model
c = s.find('-isa','Stateflow.Chart','-and','Name', <Chart Name>)
% Access the data defined in its dictionary at the level of the chart
data = c.find('-isa','Stateflow.Data')
% Access the events defined in its dictionary at the level of the chart
event = c.find('-isa','Stateflow.Event')
% Explore the data and event attributes programmatically
data(2) % etc.
event(2) % etc.
% Build a table (using a cell array) of such information
table = { data(1).Name data(1).Scope data(1).DataType;
data(2).Name data(2).Scope data(2).DataType;
data(3).Name data(3).Scope data(3).DataType } % etc.
% Export the information, e.g., to Excel

Più risposte (1)

Ryan G
Ryan G il 1 Ago 2013
Modificato: Ryan G il 1 Ago 2013
Does this blog post about model explorer on Guy's Simulink blog help?
The first video looks relevant to what you want. It's not exporting to excel, but once data is in MATLAB you can use xlswrite.
  2 Commenti
Louis Lintereur
Louis Lintereur il 1 Ago 2013
This is not quite what I am looking for. The "Find Referenced Variables" gives a list of workspace variables that the model uses. In my case, I have a Stateflow chart that contains its own set of local variables, inputs, outputs, triggers, etc. The Model Explorer displays the chart's data dictionary nicely, but I would like to export it to a spreadsheet.
Ryan G
Ryan G il 2 Ago 2013
I can't see how this may be done directly. What do you want to do with the information once it's in excel? There may be a different way to get to your end-goal.

Accedi per commentare.


Scopri di più su Programmatic Model Editing in Help Center e File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by