TO WORKSPACE FROM MATLAB

1 回表示 (過去 30 日間)
luca
luca 2019 年 7 月 9 日
回答済み: Raj 2019 年 7 月 10 日
Hi,
I have a vector V=[1 2 2 1 2 1 2 1] in the workspace and I have to transfer in Simulink as a signal.
By using the block "from Workspace", I get a continue signal and not a dicretize one (as in the figure below)
Cattura.PNG
Does someone know how to obtain the discretized value in simulink? I mean the signal with 1 and 2, that will enter a switch block
  2 件のコメント
M
M 2019 年 7 月 9 日
編集済み: M 2019 年 7 月 9 日
What do you mean by "a discretized signal" ?
Here you have a signal of dimension 8 equals to [1 2 2 1 2 1 2 1] that does not vary over time.
Do you want a signal of dimension 1 that loops over the values [1 2 2 1 2 1 2 1] ?
luca
luca 2019 年 7 月 9 日
I would like to obtain a signal in simulink that reflect the value of the vector [1 2 2 1 2 1 2 1] . But what I get is the one above.
Cattura.PNG

サインインしてコメントする。

採用された回答

Raj
Raj 2019 年 7 月 10 日
Create the data as a timeseries. See details here:
For your case:
t=[0 1 1 3 3 4 4 5 5 6 6 7 7 9 9 10]
y=[1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2]
ts=timeseries(y,t)
plot(ts) % just to confirm that this is what you want
Then in the 'from workspace' block of your Simulink model, enter 'ts' as the data to be imported.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by