%% Generating Structured Text for a MATLAB(R) Block
% 
% This  model shows the code generated for a MATLAB
% block implementing tank valve control logic.  

%   Copyright 2007-2013 The MathWorks, Inc.

%%
%This model shows the use of a MATLAB block to implement 
% the valve open/close logic for a tank.
mdl = 'plcdemo_eml_tankcontrol';
open_system(mdl);

%%
% TankControl is a MATLAB block. 
open_system('plcdemo_eml_tankcontrol/TankControl');

%%
% You can generate PLC Structured Text code for this block 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_eml_tankcontrol/TankControl');

%%
% 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.
