Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Birdman
Birdman am 3 Apr. 2018

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by