Attemp to modify a read-only model workspace

7 visualizaciones (últimos 30 días)
Chuyen
Chuyen el 25 de Mzo. de 2024
Comentada: Piyush Kumar el 29 de Abr. de 2024
Hello all,
I am getting this error when I tried to remove an parameter out of my Model workspace by .m code:
mdlWks = get_param(mdlName,'ModelWorkspace');
clear(mdlWks, objName);
However, I could not run this code line clear(mdlWks, objName) which was specified as a read-only model workspace without any reasons. This command worked for my other blocks but this did not worked.
Do you know how can I realize it is a read-only model workspace? And how can I access to this workspace to remove this parameter?
  2 comentarios
Divyanshu
Divyanshu el 1 de Abr. de 2024
Hi Chuyen,
It is difficult to reproduce the issue without model and the script file with which you are currently working. Can you share the model and the (.m) script file?
Piyush Kumar
Piyush Kumar el 29 de Abr. de 2024
Hi Chuyen,
The error message that you are receiving(regarding read-only model workspace) might be due to an attempt to access variables that are created at the update step in the lifecycle of execution of a Simulink model. The model workspace of a Simulink model becomes read-only during the update phase of the execution. To access it,
Go to the "MODELLING" tab
Open "Model Explorer"
Under the model, you will find "Model Workspace".
I also faced this error message with my model which has a callback function trying to initialize a "Simulink parameter" variable. I created this variable in the "Model Workspace" through "Model Explorer".
However, I was able to successfully delete that variable from the model workspace after the execution of the model using a clear function. Are you using clear() during the execution of the model?
If you are using callbacks, then you may trace callbacks to find out which callback is causing the issue - https://www.mathworks.com/help/simulink/ug/callback-tracer.html
As suggested by @Divyanshu, if you share the model and the code to reproduce this, it will be easier to investigate it.
Hope this helps.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interactive Model Editing en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by