如何在 Simulink 中获取当前仿真时间
要在 Simulink 中获取一个输出当前仿真时间的模块,你可以使用内置的 Clock 模块。该模块属于 Simulink 库,其输出即为当前仿真时间。
要找到它,只需打开 Simulink 库浏览器(或点击模型中的空白区域)并搜索 Clock:

该时钟模块将以浮点数形式输出当前仿真时间(以秒为单位)。
你可以将此输出连接到模型中的其他模块,以便将仿真时间用于各种用途,例如触发事件、记录数据,或基于经过的时间执行计算。
连接示例

Check out similar posts by category:
Matlab/Simulink
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow