Main Content


Get or set parameter values associated with Ladder Diagram models



currentState = plcladderoption(mdlname,Name,Value) sets the parameter to the specified value for the Simulink® ladder diagram model. Open or load the Simulink ladder diagram model first. If the Value argument is not specified this function returns the value of the specified parameter for the ladder diagram model.


collapse all

This example shows how to import a ladder diagram from a .L5X file into Simulink® and set options for simulating the imported ladder file by using the plcladderoption function.

Import Ladder File

Import the simpleController.L5X file by using the plcimportladder function.

[mdlName,mdlLib,busScript] = plcimportladder('simpleController.L5X','OpenModel','On')
mdlName = 
mdlLib = 
busScript =


The imported model conatins a PLC Controller block named simpleController, a Task block named MainTask and a Ladder Diagram Program block named MainProgram.

Enable Fast Simulation of Imported Ladder Diagram Model

Enable FastSim by using the plcladderoption function.

currentState = plcladderoption('simpleController','FastSim','on');

Input Arguments

collapse all

Specifies the name of the generated Simulink model.

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: plcladderoption('simpleController','Animation','on')

When 'on', this option disables all animation and data display. If 'FastSim' is set to 'on', then any change made to 'Animation' and 'DataDisplay' parameter would not change simulation behavior.

This option enables/disables animation of Ladder Diagram rungs, when 'FastSim' is in 'off' state

This option enables/disables data display of Ladder Diagram rungs, when 'FastSim' is in 'off' state

This option enables/disables using Simulink Design Verifier features with Ladder Diagrams. Set 'SLDV' parameter to 'on' before SLDV analysis. SLDV analysis could be still done without using 'SLDV' option, by setting 'FastSim' to 'on' and 'Prescan' to 'off'.

This option enables/disables Prescan for instructions and AOI blocks explicitly for Simulink Design Verifier analysis.

Output Arguments

collapse all

The value of the specified parameter name for the ladder diagram model.

Introduced in R2019a