Is there any limitation for using set_param(bdroot,'SimulationCommand','WriteDataLogs'), while starting a simulation using 'sim' command?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to get live data from a model with the help of ToWorkspace block.The simulation is started using 'sim' command.A block of the model has a callback 'set_param(bdroot,'SimulationCommand','WriteDataLogs')' to get data.
Is it possible to use this command in this manner? Does MATLAB allows this?
0 comentarios
Respuestas (1)
Swastik Sarkar
el 19 de Sept. de 2024
The writedatalogs command is indeed a recognized Simulink command, but incorporating it into a callback can lead to issues. Specifically, MATLAB may crash shortly after the simulation begins because the command alters the simulation state as it starts.
Instead, using the set_param function with SimulationCommand in the MATLAB Command Window effectively writes data logging variables to the MATLAB Workspace without causing instability.
To execute this properly, use the following command in the MATLAB Command Window:
set_param(mdlname, 'SimulationCommand', 'writedatalogs');
For additional details and guidance, refer to the official documentation::
0 comentarios
Ver también
Categorías
Más información sobre Model, Block, and Port Callbacks 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!