How do i pause every iteration in a for iteration subsystem for a specified amount of time?

1 vue (au cours des 30 derniers jours)
For the simulink external mode setting, i am planning to design a simulink model that is equivalent to:
for i = 1:16
for j = 1:16
......configure multiplexers......................
......read some data from sensors that have refresh rate of 0.02s...........
pause(0.02) %pause for 0.02milliseconds
end
end
I have noticed that for iteration subsystems have either a -1 or inf sample time setting. It would be great if the sample time can be configured for the inner for loop. I have also encountered compiling errors when a custom matlab pause function attached to a data source is written within the for iteration subsystems. Are there any solutions to replicating this logic in simulink?

Réponses (1)

Chidvi Modala
Chidvi Modala le 7 Août 2019
you can refer to Access Block Data During Simulation which lets you work your MATLAB code into simulation process. In the provided documentation you can see the mechanism involves attaching a Post Outputs callback to specific block, so your function is called at every step that the block produces new outputs.

Catégories

En savoir plus sur Subsystems 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!

Translated by