Simulink write to array index

23 次查看(过去 30 天)
Brecht Vermeulen
Brecht Vermeulen 2018-7-20
Goodmorning,
Which block should be used to write to a specific index of an array in Simulink.
Eg. I have a signal with an array [2, 1, 8, 5] and I want to write a 2 to index 3, keeping the other values equal. This should result in an array [2,1,3,5].
Should this really be done by a matlab function?
Kr, BV

回答(2 个)

Birdman
Birdman 2018-7-20
Of course it can be done. Check the attached files.
  1 个评论
Antony Smith
Antony Smith 2022-5-26
I s there really no 'inverse' block to the "Index Vector" block??
Seems like quite an oversight on behalf of simulink functionality?

请先登录,再进行评论。


TAB
TAB 2018-7-26
编辑:TAB 2018-7-27
Use Assignment block.
OR
Split the array signal using Demux. Then connect the all (except desired index to change) outputs to Mux. Connect other signal at desired index.

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by