From a matrix creating a vector

1 visualización (últimos 30 días)
Emilia
Emilia el 24 de Jul. de 2022
Comentada: Star Strider el 24 de Jul. de 2022
Hello,
I have matrix
A=[1 7 3 9 4; 8 6 8 9 1; 7 7 7 8]
I need to find the existing numbers from the matrix and create a vector, for example like this Vector1=[1 3 4 6 7 8 9]
and also count the numbers several times, for example like this Vector2=[2 1 1 1 4 3 2]
Thanks for the helpers :)
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 24 de Jul. de 2022
unique and histcounts will help you
Emilia
Emilia el 24 de Jul. de 2022
Thank you !

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 24 de Jul. de 2022
Use the unique and accumarray or histcounts functions.
This appears to be homework, so I leave the coding to you.
  2 comentarios
Emilia
Emilia el 24 de Jul. de 2022
Thank you !
Star Strider
Star Strider el 24 de Jul. de 2022
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by