Vector Element Update in Simulink
18 views (last 30 days)
Show older comments
My Simulink simulation contains a fixed output vector signal [256 elements] which only a few elements of it is updated at a time depending on given the phase of the simulation.
For example I'd like to only update elements [5 to 10] in the fixed [256 element] output vector and don't re-arrange or change the elements that are not used in the output vector. I've noticed that the "Selector" block only filters certain elements of a vector or rearranges it. Unfortunately I haven't come across any library blocks which does the opposite, simply write a value in a defined element of a vector signal.
I've tried a few tricks with the "Merge" block though this block simply adds elements to the existing [256] element vector and doesn't over-write certain elements.
My thoughts are that I may have to create an embedded matlab function to do this vector element reassigning function.
Thought I check with the experts to see if there is an easier way to implement this.
I appreciate your help!
Nima
Answers (1)
TAB
on 13 Sep 2012
Edited: TAB
on 13 Sep 2012
Split your matrix in different part, alter the part which you want, then Concatenate all parts again in one matrix.
In your case
- Use 3 selector blocks to split the [265 element vector] into [1:4 element], [5:10 element] & [11:256 element].
- Now do your required operation on [5:10 element] vector generated from 2nd selector block.
- Finally merge all 3 into single vector using Vector Concatenate block.

0 Comments
See Also
Categories
Find more on Array and Matrix Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!