The specified superclass rl.env.MAT​LABEnviron​ment' contains a parse error , cannot be found on MATLAB search path , or is shadowed by another file with same name

151 views (last 30 days)
I am defining custom RL environment as
classdef SmallCellEnv < rl.env.MATLABEnvironment
but it gives error when I run it in MATLAB offline 'The specified superclass rl.env.MATLABEnvironment' contains a parse error , cannot be found on MATLAB search path , or is shadowed by another file with same name, How to resolve this error.

Answers (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni on 28 May 2021
Edited: Shiva Kalyan Diwakaruni on 28 May 2021
Generally the error "cannot be found on MATLAB's search path, or is shadowed by another file with the same name." is received when there is a user defined function in the MATLAB search path which has the same name as the MATLAB built-in function. In order to resolve the issue follow the troubleshooting steps below:
a) Please, manually go through the MATLAB search path and remove the paths which have functions conflicting with in build MATLAB functions. Execute the following command to get the list of the current search path.
>> path
The following command may help to find the source of the issue:
>> which -all <conflicting_function>
b) If you are unsure of which paths to remove or the above command displays only one line, please restore the MATLAB search path to its factory-installed state by executing the following command :
>> restoredefaultpath
Please, notice that the above command may remove the paths that you have previously added to MATLAB search path in order for your scripts to work. So it is advisable to save a backup copy of the current MATLAB search path before running the command.
Please, refer to the following link to the documentation to backup the current search path:
if the above error still persists please try the below steps
  1. Debug the code with "dbstopiferror" and locate the line.
  2. Execute "rehash toolboxcache" and "restoredefaultpath" and check if it still results in error.
  3. Try creating a new custom system object by inheriting "rl.env.MATLABEnvironment'" and check if calling this also results in the same error.
  4. Try p-coding your custom class and check if this results in the same error.
  5. Try executing the command "clear classes" and check if the error goes away.
  6. If none of the above steps work, reinstall the MATLAB as this issue may have been related to corrupted class hierarchies in MATLAB.
Hope it helps

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!