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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by