%% Generate Structured Text Code for a Simple Simulink(R) Subsystem
% This example shows how to select the target IDE for a Simulink(R) model,
% generate code, and view generated files.
%
%   Copyright 2007-2013 The MathWorks, Inc.
%%
% 1. Open model |plcdemo_simple_subsystem| and save a copy to a writable
% location.

open_system('plcdemo_simple_subsystem')

%%
% 2. Open the *Simulink PLC Coder* app.

%%
% 3. Open the PLC Code Generation dialog box.. In the Target IDE select *3S
% CoDeSys 2.3*.
%
% <<../simple_subsystem_configuration.png>>
%
% Click *OK*
%%
% 4. Select the |SimpleSubsystem| block and click *Generate PLC Code*.
% Alternatively, from the command line, enter:
%
%   generatedfiles = plcgeneratecode('plcdemo_simple_subsystem/SimpleSubsystem');
%
% <<../simple_subsystem_generate_code.png>>
%%
% 5. View the code generation report.
%
% The report includes links to the generated code file
% |plcdemo_simple_subsystem.exp| and associated traceability and code
% metrics reports.
%
% <<../simple_subsystem_code_gen_report.png>>
%%
% 6. This figure contains the generatecode |plcdemo_simple_subsystem.exp|.
%
% <<../simple_subsystem_generated_code.png>>
%% Related Topics
%
% * <docid:plccoder_ug.bseap_0-1 Generate and Examine Structured Text Code>



