- One of the possible reason is the parameter is compile-time rather run-time. It usually happens when working with simscape blocks. As a workaround, change preferences -> simscape and enable "show run-time parameter settings". Then open the block, find the option and switch it to "run-time".
- Another possible reason might be cache. Althought you change the model and save, .exe still use the old version of model. In this case, delete slprj folder and .slxc file. Then compiler / package it again.
setVariable() not having an effect
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
green_ananas
le 2 Mar 2021
Commenté : green_ananas
le 5 Mar 2021
Hey everyone
I am trying to set up a reinforcement learning setup, where the initial conditions should be randomized after every episode. In my reset function, I have the following code:
ball.x0 = -0.04 + 0.08*rand; % m, ball initial x distance from center of plate
ball.y0 = -0.04 + 0.08*rand; % m, ball initial height from the top surface of plate
ball.z0 = 0;
ball.x0
ball.y0
in = setVariable(in,'ball',ball);
In my Simulink model, I have specified the input variable in the 6-DOF Joint primitive. But now, the ball starts at the same position every time, altough it should be randomized. Do you have any ideas?
Thanks a lot!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/536296/image.png)
0 commentaires
Réponse acceptée
Shadaab Siddiqie
le 5 Mar 2021
Modifié(e) : Shadaab Siddiqie
le 5 Mar 2021
From my understanding setvariable is not having any effect. This might be due to :
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulation and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!