Converting first column unique values to number
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bewler
el 28 de Jun. de 2019
Comentada: Bewler
el 1 de Jul. de 2019
I have a table that I need to use for another function.
Currently the table is setup as
Base1,x,y,z
Base1,x,y,z
Building2,x,y,z
Building2,x,y,z
Complex3,x,y,z
Complex3,x,y,z
Complex3,x,y,z
What I would like to do is rename the first column if they have unique names so Base1 would switch to 1, Building2 switches to 2 ect...
Is there an easy way to rename all of the first column based on if the values are unique or not?
2 comentarios
Respuesta aceptada
Matt J
el 28 de Jun. de 2019
Editada: Matt J
el 28 de Jun. de 2019
[~,~,u]=unique(yourTable{:,1},'stable');
yourTable{:,1}=num2cell(u)
Más respuestas (0)
Ver también
Categorías
Más información sobre Other Formats en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!