accessing workspace variables in embedded matlab function
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a very large model that has numerous busses with lots of data. I enabled data logging on several busses and wrote a matlab function to post process the data logged in the workspace variable 'logsout'. However, I cannot log the data for the full simulation because I run out of memory. Therefore, I would like to run my post processing periodically on the 'logsout' workspace variable then clear the variable and and continue. I was hoping this would allow the simulation to complete without running out of memory.
However, I cannot seem to access the logsout variable in an embedded matlab function. Any suggestions?
0 commentaires
Réponses (3)
Kaustubha Govind
le 21 Fév 2012
I'm not sure that it is safe to clear the 'logsout' variable during simulation, because the model might have it locked down. Additionally, I imagine that the model writes to an intermediate buffer and only populates the workspace at periodic intervals when the buffer gets full, so there is no guarantee that at time 't', all the data points corresponding to simulation from 0 to 't' have been logged to the workspace.
Have you considered instead saving and restoring the simulation state, so that you can break down your simulation time into short intervals, so that you can work on the 'logsout' piecemeal?
0 commentaires
timothy shands
le 21 Fév 2012
1 commentaire
Kaustubha Govind
le 22 Fév 2012
1) Yes, you would need to repeat your simulation 100 times, for 19 seconds each time, by restoring the previous simulation state each time. For how - refer to the documentation link I pointed to in my original answer.
2) Are you using a non-virtual bus (should have a Simulink.Bus object corresponding to your signal)? Virtual buses are not supported as inputs to the Embedded MATLAB Function block. Also, if you are using non-virtual bus inputs, you need to configure the block input port accordingly. See http://www.mathworks.com/help/toolbox/simulink/ug/bq156zx.html
Voir également
Catégories
En savoir plus sur Prepare Model Inputs and Outputs dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!