How can I use one data element from my MAT-file each time a trigger is issued in Simulink?

1 回表示 (過去 30 日間)
I have a data vector stored in a MAT-file, and every time a trigger is issued, I would like to get the next data element from the MAT-file data vector.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
You can do this by first loading the data vector inside the MAT-file into the MATLAB workspace using the model's "PreLoadFcn", and then using a Selector block that selects only one data element from the data vector each time a trigger is issued.
An example model (triggered_example.mdl) is attached. In the example, a Constant block is used to store the data vector. The Selector block chooses the next data element, based on the output of a counter. The counter is implemented by using a Sum block with a feedback.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by