Accessing variable (current and previous time steps) for use in a MATLAB function block during simulation in Simulink.
24 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sune Grobbelaar
le 1 Avr 2023
Commenté : Sune Grobbelaar
le 3 Avr 2023
Hi, I have attached a screenshot of my simplified Simulink model below. In the MATLAB function block I require access to the variable value at the current and previous timesteps. In other words, a vector of historic variable values, starting at t = 1, and appended at each time step to include the most recent value. Thus far I have only been able to find solutions that would allow me to access the data when the simulation is paused or completed (e.g To Workspace). Are there perhaps any solutions to access the data whilst the simulation is running?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1342524/image.png)
0 commentaires
Réponse acceptée
Samyuktha
le 3 Avr 2023
Hi Sune,
It is my understanding that you want to access data continuously when the simulation is running.
Please refer to the follwing documentation link for the recommended technique:
Hope this helps!
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sources 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!