MATLAB: “Simple” way to determine the number of different types of components used in a Simulink model

Embedded Codermatlab codersimulinksimulink coderstate-flowstateflow

I am working with a large Simulink model, and need to determine how many instances of model references, EML blocks, state flow blocks, and S-function blocks are contained in the model. Here's where I am at currently:
  • I have resolved the model references by using the find_mdlrefs(system) function, and
  • I have generated a list of all of the file dependencies using dependencies.fileDependencyAnalysis(system) function, which allows me to parse the list in search of particular extensions such as .cpp for S-functions or .m for EML blocks, but this doesn't give me much help in terms of State Flow blocks (and I'm not sure the idea that all EML blocks have an associated .m is a sound assumption as I explain this).
  • I am currently playing with the find_system(system) function as well.
It seems to me I'm going to need to write a recursive script that digs through each model reference using find_system(system), but this will not give me the extensions of each component, and still does not seem to yield any information as to whether a subsystem is a state flow block or not. Does anyone have a solution to this? Any and all ideas are appreciated.

Best Answer

Suggestion of sldiagnostics function helped. Documentation here .
It can help find 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.(among other things)