| Contents | Index |
[txtRpt, sRpt] = sldiagnostics('sys')
[txtRpt, sRpt] = sldiagnostics('sys', options)
sldiagnostics('sys') displays the following diagnostic information associated with the model or subsystem specified by sys:
Number of each type of block
Number of each type of Stateflow object
Number of states, outputs, inputs, and sample times of the root model.
Names of libraries referenced and instances of the referenced blocks
Time and additional memory used for each compilation phase of the root model
If the model specified by sys is not loaded, then sldiagnostics loads the model before performing the analysis.
The command sldiagnostics('sys', options) displays only the diagnostic information associated with the specific operations listed as options strings. The table below summarizes the options available and their corresponding valid input and output.
With sldiagnostics, you can input the name of a model or the path to a subsystem. For some analysis options, sldiagnostics can analyze only a root model. If you provide an incompatible input for one of these analyses, then sldiagnostics issues a warning. Finally, if you input a Simulink Library, then sldiagnostics cannot perform options that require a model compilation (Update Diagram). Instead, sldiagnostics issues a warning.
During the analysis, sldiagnostics will follow library links but will not follow or analyze Model References. See find_mdlrefs for more information on finding all Model blocks and referenced models in a specified model.
Option | Valid Inputs | Output |
|---|---|---|
CountBlocks | root model, library, or subsystem | Lists all unique blocks in the system and the number of occurrences of each. This includes blocks that are nested in masked subsystems or hidden blocks. |
CountSF | root model, library, or subsystem | Lists all unique Stateflow objects in the system and the number of occurrences of each. |
Sizes | root model | Lists the number of states, outputs, inputs, and sample times, as well as a flag indicating direct feedthrough, used in the root model. |
Libs | root model, library, or subsystem | Lists all unique libraries referenced in the root model, as well as the names and numbers of the library blocks. |
CompileStats | root model | Lists the time and additional memory used for each compilation phase of the root model. This information helps users troubleshoot model compilation speed and memory issues. |
RTWBuildStats | root model | Lists the same information as the CompileStats diagnostic. When issued with the second output argument sRpt, it captures the Simulink Coder build statistics in sRpt.rtwbuild. You must explicitly specify this option; it is not part of the default analysis. |
All | not applicable | Performs all diagnostics. |
Note Running the CompileStats diagnostic before simulating a model for the first time will show greater memory usage. However, subsequent runs of the CompileStats diagnostic on the model will require less memory usage. |
[txtRpt, sRpt] = sldiagnostics('sys') or [txtRpt, sRpt] = sldiagnostics('sys', options) returns the diagnostic information as a textual report txtRpt and a structure array sRpt, which contains the following fields that correspond to the diagnostic options:
blocks
stateflow
sizes
links
compilestats
rtwbuild
If your chosen options specify just one type of analysis, then sRpt contains the results of only that analysis and it is not a structure.
The following command counts and lists each type of block used in the sldemo_bounce model that comes with Simulink software.
sldiagnostics('sldemo_bounce', 'CountBlocks')The following command counts and lists both the unique blocks and Stateflow objects used in the sf_boiler model that comes with Stateflow software; the textual report returned is captured as myReport.
myReport = sldiagnostics('sf_boiler', 'CountBlocks', 'CountSF')The following commands open the f14 model that comes with Simulink software, and counts the number of blocks used in the Controller subsystem.
sldiagnostics('f14/Controller', 'CountBlocks')The following command runs the Sizes and CompileStats diagnostics on the f14 model, capturing the results as both a textual report and structure array.
[txtRpt, sRpt] = sldiagnostics('f14', 'Sizes', 'CompileStats')
Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |