convert array in simulink to a time block

1 回表示 (過去 30 日間)
Syed hamza Ali Tirmizi
Syed hamza Ali Tirmizi 2018 年 4 月 4 日
回答済み: Birdman 2018 年 4 月 4 日
i am creating an array,
x=[1 2 3 4 5 6 7 8];
t=1:8;
plot(t,x)
but what about simulink how can i tell simulink it is timed array, and not to sample it again & again. Please see images

回答 (1 件)

Birdman
Birdman 2018 年 4 月 4 日
The workaround of this problem is to use From Workspace block and provide a time column to the data. Go to File->Model Properties->Model Properties->Callbacks->PreLoadFcn and write
t=1:8;x=1:8;
Data=[t.' x.'];
and then in your model, open From Workspace block and write
Data
Then observe the output.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by