%% Structured Text Code Generation Support for Enumerated Data Type Conversion
% This example shows how to autogenerate structured text code
% for the enum to integer conversion model

% Copyright 2019 The MathWorks, Inc.

%% Load enum class
% For this example, the |myEnum.m| script loads the enum class definition.
% Place this script file in the same project folder as the
% |menum_cast_enum_convert_int| model file.
%% Open Simulink Model
% To open the Simulink test bench model, use the following command.
open_system('menum_cast_enum_convert_int')
%% Configure Subsystem For Enum To Integer Function Generation
% To auto generate structured text code for the enum to int conversion,
% use <docid:plccoder_ug.mw_90db60fa-d201-42b7-942b-9ca6d26ac828 Generate
% enum Cast function>.
%%
%
% # Open <docid:plccoder_ref.mw_18cc822d-26bc-48aa-8ab8-3c0bbadb066b
% Simulink PLC Coder app>.
% # Select the |Subsystem| block.
% # Click *Settings*. Navigate to *PLC Code Generation* > *Identifiers*.
% Select the checkbox next to |Generate enum cast function|.
% # Click |OK|.

%% Generate Code for the Subsystem
% To generate code for the subsystem use
% <docid:plccoder_ref.bsei6je_1 plcgeneratecode>
generatedfiles = plcgeneratecode('menum_cast_enum_convert_int/Subsystem');