| Simulink® | ![]() |
[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
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, sldiagnostics loads the model, completes the diagnostics, and then closes the model. If sys is a subsystem, the root model must be loaded for sldiagnostics to operate successfully.
Note To see memory usage, you must first enable the MATLAB® memory integrity checking option at startup. This is accomplished by running MATLAB with the -check_malloc flag. For more information about this startup option, see matlab (Windows) or matlab (UNIX) in the MATLAB Function Reference. |
sldiagnostics('sys', options) displays only the diagnostic information associated with the specific operations listed as options strings. The available options and their output are as follows:
Option | Description |
|---|---|
CountBlocks | 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 | Lists all unique Stateflow objects in the system and the number of occurrences of each. |
Sizes | Lists the number of states, outputs, inputs, and sample times, as well as a flag indicating direct feedthrough, used in the root model. |
Libs | Lists all unique libraries referenced in the root model, as well as the names and numbers of the library blocks. |
CompileStats | Lists the time and additional memory used for each compilation phase of the root model. The memory usage is displayed when the MATLAB memory integrity checking option is enabled at startup. This information helps users troubleshoot model compilation speed and memory issues. |
Verbose | Lists the results of the CompileStats diagnostic during the compilation phase. This is useful for diagnosing the compilation itself if it takes an unreasonable amount of time or hangs. |
RTWBuildStats | Lists the same information as the CompileStats diagnostic. When issued with the second output argument sRpt, it captures the Real-Time Workshop® build statistics in sRpt.rtwbuild. |
All | 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 return a lesser amount of 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
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.
f14; 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')![]() | sldebug | sldiscmdl | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |