Simulink: Array cannot be held and updated by using Data store, if-else and merge block
Afficher commentaires plus anciens
Hello,
I initialize an all zero Array. I want to use if-else block,merger block and Data store block to overwrite and update the Array. But after the if-else block, the data inside the Array get lost when switching between if and else blocks. Which means it cannot hold the data in the Array after the execution of if-else block.

For example, I have two columns of vectors,which is called Test_Array. My requirement is, when I see a 1 in the second column of the Test_Array, I will write the element in the first column to the all zero Array that base on its index; when I see a 0, I will write a fixed number 5 to the Array base on its index. In the end, this all zero Array will be filled with either '5' or the elements from the first column of the Test_Array.

So from the pic above you can see, before we encounter with a 0, which means before we switch from if block to else block, the holding behavior is fine. However after seeing a 1, it lost its previous 5. And this situation happens every time when switching between if and else block.
As a requirement, all the procedure should be done with built in simulink blocks, no code at all.
The model is attached.
I am very new to simulink, and I will be grateful for any advice. Thank you
Long
Réponses (0)
Catégories
En savoir plus sur Sources dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!