MATLAB: How to get the variant names inside a Simulink variant subsystem

simulinkvariant subsystem

I have a simple variant subsystem in my Simulink model, where I want to get the names of the subsystems inside. In addition it would be nice to read out the Variant control expression, which is assigned to each subsystem as well.
The subsystem is simple in the sense that it only uses a workspace variable to control the active block. I do not use any variant object, nor do I use the variant manager.

Best Answer

If you run find_system(), set the 'Variants' option (use 'AllVariants'). For subsystem inside the variant subsystem, the property is "VariantControl"
Related Question