How to create a frequency table using a list of string values

Hello,
I have a list of 6,057,936 string values, some are unique, many are repeated multiple times. I need to create a table that lists each unique string (likely 1,000-2,000), as well as the number of times this string occurs. Could anyone help me to do this in Matlab?
Thank you,
Diana

 Respuesta aceptada

Star Strider
Star Strider el 6 de Dic. de 2018
I would use unique and accumarray. An example is given in the documentation section Count of Unique Elements (link).

2 comentarios

This is a great idea, but for my dataset (text string array) accumarray was not working unfortunately. What did work was the summary function. It returned fields for categories (same result as unique) as well as counts.
Thanks again,
Diana
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Productos

Versión

R2018a

Preguntada:

el 6 de Dic. de 2018

Comentada:

el 9 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by