How to generate C code with coder for just a subsystem in PLECS ?

I designing an inverter simulation, so I would like to generate code for my controller which is inside the sub-system. Is it even possible? Ever time I tried to generate it only generated for the entire model. I even tried putting the controller into an atomic subsystem still, it generated for the entire Plecs file.

Hi Shaz,

Yes, absolutely. This is given in the PLECS User Manual here, under “Generating Code” within the chapter titled “Code Generation”."To enable a subsystem for code generation, select the subsystem, then choose Execution settings… from the Subsystem submenu of the Edit menu or the context menu. In the Subsystem Settings dialog check the option Enable code generation. Note that it is not possible to enable code generation for a subsystem that is contained by or that itself contains other subsystems that enable code generation."Regards,Manu