Open up the "Controller" subsystem. Open the Stateflow® chart named "Control" chart inside it. This chart implements the control logic for starting and stoping the conveyer belt motor depending on sensor inputs.
You can generate PLC Structured Text code for this subsystem by right-clicking on the subsystem block and select PLC Code -> Generate Code for Subsystem Alternatively, you can use the following command generatedFiles = plcgeneratecode('plcdemo_cruise_control/Controller');
After the code generation, the Diagnostic Viewer window is displayed with hyperlinks to the generated code files. You can open the generated files by clicking on the links.