repeating elements of vector by the no. of times equal to elements in another vector

1 回表示 (過去 30 日間)
i have a vector v. i have another vector of same length, r. i want to take first element of v, v(1), repeat it r(1) times, store it in a big vector W. then i want to take second element of v, v(2), repeat it r(2) times, and append W with it. and so on until all elements in v are finished.
i want this:
W= [ [v(1) repeated r(1) times] [v(2) repeated r(2) times] .......[v(n) repeated r(n) times] ] where n is the length of r and v. How can i do this?

採用された回答

Birdman
Birdman 2018 年 4 月 3 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by