Borrar filtros
Borrar filtros

Simple vector question.

1 visualización (últimos 30 días)
Sebastian Daneli
Sebastian Daneli el 4 de Abr. de 2022
Comentada: Sebastian Daneli el 4 de Abr. de 2022
Say that I have the vectors
v1=[1 2 3]
v2=[4 3 8]
how can I, by using these two, create the following vector
v3=[4 3 3 8 8 8]
i.e., a vector with one 4s, two 3s and three 8s.

Respuesta aceptada

David Hill
David Hill el 4 de Abr. de 2022
v=repelem(v2,v1);
  3 comentarios
David Hill
David Hill el 4 de Abr. de 2022
sum(~isnan(X),2)
Sebastian Daneli
Sebastian Daneli el 4 de Abr. de 2022
Great, thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by