フィルターのクリア

Matrix Manipulation based on index

1 回表示 (過去 30 日間)
Mark Cejas
Mark Cejas 2013 年 8 月 23 日
Hi all,
I would appreciate assistance to do the following:
I have the following vector
v=[1
1
2
3
3
3
3
3
3
4
4
4
4
]'
each number of this vector is an index value that repeats a certain number of times, or not at all. I would like to use as a recipe to modify the following matrix M. The matrix M contains unique rows that pertain to a particular index value in the vector v as such:
M=
1 0.0127 5.0127
2 0.00266 5.00266
3 0.00263 5.00263
4 0.00266 5.00266
I would like to use the sequence of unique indices in v as a recipe to repeat the rows in the matrix M and produce the following matrix P:
P=
1 0.0127 5.0127
1 0.0127 5.0127
2 0.00266 5.00266
3 0.00263 5.00263
3 0.00263 5.00263
3 0.00263 5.00263
3 0.00263 5.00263
3 0.00263 5.00263
3 0.00263 5.00263
4 0.00272 5.00272
4 0.0129 5.0129
4 0.0129 5.0129
4 0.0129 5.0129
Notice the rows of matrix P are repeated in the exact sequence as listed in the index vector v.
I would greatly appreciate any help.
thank you,
Mark

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 23 日
編集済み: Azzi Abdelmalek 2013 年 8 月 23 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by