Model initialization from a callback in the mask of simulink Block
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi Everyone,
I am trying to read the compiled sample time of a Block in its mask through a callback connected to a button in the mask of the block. But before I read the Compiled Sampletime, it is necessary for me to initialize the Model, for which I have written the following command in my callback:
set_param(bdroot,'SimulationCommand','Update')
But I get the following error:
![2019-08-21_08h59_54.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/234832/2019-08-21_08h59_54.png)
I tried another way of executing the same, and yet I am presented with the same error.
evalin('base', 'set_param(bdroot,''SimulationCommand'',''Update'')')
![2019-08-20_17h38_17.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/234833/2019-08-20_17h38_17.png)
What is it that I am doing wrong?
Thanks in advance :)
Regards,
Vamsi
6 comentarios
Fangjun Jiang
el 21 de Ag. de 2019
From the error message, it looks like that your block is a library link. Can you first try to break the link and test if a callback of model update can be done from a mask? Library link sometimes can make things complicated. Try to put that aside first.
Respuestas (1)
Fangjun Jiang
el 21 de Ag. de 2019
There are a few terms involved here. You need to try it out to see if it is possible to achieve what you desire to do. The point is that you can't self-modify the library block except what is allowed as "Parameterized links"
Dynamic Masked Subsystem
web(fullfile(docroot, 'simulink/ug/create-dynamic-masked-subsystems.html'))
Parameterized Links and Self-Modifiable Linked Subsystems
web(fullfile(docroot, 'simulink/ug/parameterized-links-and-self-modifiable-linked-subsystems.html#bu9117h'))
0 comentarios
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!