MATLAB Answers

0

Simulink write to array index

Asked by Brecht Vermeulen on 20 Jul 2018
Latest activity Edited by TAB
on 27 Jul 2018
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

  0 Comments

Sign in to comment.

Products


Release

R2016b

2 Answers

Answer by Birdman
on 20 Jul 2018

Of course it can be done. Check the attached files.

  0 Comments

Sign in to comment.


TAB
Answer by TAB
on 26 Jul 2018
Edited by TAB
on 27 Jul 2018

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.

  0 Comments

Sign in to comment.