create a vector of repeated different values and different repetitions

4 visualizaciones (últimos 30 días)
hello,
i have data that looks like this
Value repetition
1 5
3 2
5 3
6 1
10 4
i want to create a vector that looks like this
1 1 1 1 1 3 3 5 5 5 6 10 10 10 10
so basically, repeats the numbers in Value colum n repititions.
can anyone please help? thanks

Respuesta aceptada

Steven Lord
Steven Lord el 11 de Mzo. de 2021
Take a look at the repelem function.
  1 comentario
Mohammad Aljarrah
Mohammad Aljarrah el 11 de Mzo. de 2021
Editada: Mohammad Aljarrah el 11 de Mzo. de 2021
it worked, thanks
z = repelem (a(:,1), b(:,1));
gievn that a and b are column vectors

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by