Main Content


Create custom reinforcement learning environment template



rlCreateEnvTemplate(className) creates and opens a MATLAB® script that contains a template class representing a reinforcement learning environment. The template class contains an implementation of a simple cart-pole balancing environment. To define your custom environment, modify this template class. For more information, see Create Custom MATLAB Environment from Template.


collapse all

This example shows how to create and open a template file for a reinforcement learning environment.

For this example, name the class myEnvClass


This function opens a MATLAB® script that contains the class. By default, this template class describes a simple cart-pole environment.

Modify this template class, and save the file as myEnvClass.m

Input Arguments

collapse all

Name of environment class, specified as a string or character vector. This name defines the name of the class and the name of the MATLAB script.

Version History

Introduced in R2019a