How to change a single value on a different vector cell each time? (simulink)
古いコメントを表示
Hello,
in Simulink I have a vector V = [1 0 2 1]. I make a calculation to know which of those four values I have to change. Then, how can I only modify one of those values?
The subprogram sequence is like this:
- Read vector V
- Calculate index to be changed = X
- Change index X in vector V
- Read vector V
- Calculate index to be changed = Y
- Change index Y in vector V
- ...
If I could save the index in to a variable and then use it on the "Overwrite Values" block it will be done. But I don't know how to do it.
Other way to get my problem done will be using something similar to an "Index Vector", but instead of several inputs an one output, one input and several selectionable outputs.
Many thanks! Daniel.
2 件のコメント
José-Luis
2012 年 11 月 5 日
What's wrong with:
V(your_idx) = new_value;
Dani Tormo
2012 年 11 月 5 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!