Vector Element Update in Simulink

18 ビュー (過去 30 日間)
Nima Forghani
Nima Forghani 2012 年 9 月 13 日
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
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 13 日
it's not clear for me

サインインしてコメントする。

回答 (1 件)

TAB
TAB 2012 年 9 月 13 日
編集済み: TAB 2012 年 9 月 13 日
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.

カテゴリ

Help Center および File ExchangeArray and Matrix Mathematics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by