How to implement reinforcement learning in Dspace using code generation
7 views (last 30 days)
Show older comments
Davoud Mokhtari Andani
on 31 Aug 2023
Commented: Davoud Mokhtari Andani
on 8 Sep 2023
I have trained a nonlinear model using Reinforcement learning via MATLAB 2022b and now I want to implement the reinforcement learning block in dSPACE using code generation, while the simulink will pop out the error "Code generation does not support importing handle classes from matlab".What should I do to fix this error? Thank you very much. Any suggestions are appreciated.
0 Comments
Accepted Answer
Milan Bansal
on 7 Sep 2023
Hi,
As per my understanding you are facing an error when implementing Reinforcement Learning (RL) Agent block using code generation.
The Reinforcement Learning Agent block does not support code generation for training. A workaround for this issue is to use Simulink Blocks such as MATLAB function Block or "Predict" block from Deep Learning Toolbox in place of RL Agent Block, which will allow using pre-trained networks including RL Policies in Simulink and supports code generation.
Refer to the MATLAB Answer link below which resolves a similar issue.
However, if the error is due to code generation for MATALB handle class, it is required to have a function that invokes the class.
Refer to the example in the documentation link given below.
More Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!