Simulink write to array index

23 visualizaciones (últimos 30 días)
Brecht Vermeulen
Brecht Vermeulen el 20 de Jul. de 2018
Comentada: Antony Smith el 26 de Mayo de 2022
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

Respuestas (2)

Birdman
Birdman el 20 de Jul. de 2018
Of course it can be done. Check the attached files.
  1 comentario
Antony Smith
Antony Smith el 26 de Mayo de 2022
I s there really no 'inverse' block to the "Index Vector" block??
Seems like quite an oversight on behalf of simulink functionality?

Iniciar sesión para comentar.


TAB
TAB el 26 de Jul. de 2018
Editada: TAB el 27 de Jul. de 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.

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by