MATLAB Answers

Leon Loh
0

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

Asked by Leon Loh
on 31 Jul 2019
Latest activity Answered by Chidvi Modala on 7 Aug 2019
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?

  0 Comments

Sign in to comment.

1 Answer

Answer by Chidvi Modala on 7 Aug 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.

  0 Comments

Sign in to comment.