The following example demonstrates how to import a simple ladder diagram from an L5X file (simpleController.L5X
) into the Simulink environment. The ladder L5X file was created using RSLogix 5000 IDE and contains contacts and coils representing switches and motor. The following is a snapshot of the ladder structure.

Use the plcladderimport
function to import the ladder into Simulink. For this example, the program Name
of the ladder is MainProgram
and the MainRoutineName
is MainRoutine
.
mdlName =
'simpleController'
mdlLib =
'simpleController_lib'
busScript =
[]
The imported model contains a PLC Controller block named simpleController
, followed by a Task block named MainTask
and finally a Ladder Diagram Program block named MainProgram
. The model imported into Simulink has blocks that implement the functionality of the contacts and coils.
You can traverse up these organizational blocks by double-clicking the Up to Parent POU
element. The Program Variables
spreadsheet contains the variables Start
, Stop
, and Motor
. You can use this table to modify attributes of the variables such as Data Type
, Initial Value
, and size