我使用的是Simulink中内置的s函数,我需要实现一个等待时间。例如,我需要这样做:
send the first frame
wait 20 ms
send the second frame
wait 20 ms
send third frame我如何在两帧之间建立这个等待时间。我使用的是C语言和一个1级Matlab S函数。
发布于 2014-04-08 20:29:33
首先,很难获得毫秒级的精度。这在很大程度上取决于您的硬件、操作系统和运行的进程。
只需使用pause命令即可实现此目的
send the first frame
pause(0.020)
send the second frame
pause(0.020)
send third frame或者使用timer objects http://www.mathworks.com/help/matlab/ref/timerclass.html
这两种解决方案都不准确。最好的解决方案是根据外部事件进行计时。每帧发送后有没有触发事件?
https://stackoverflow.com/questions/22935640
复制相似问题