Sorting 256*2 cell
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jaewon Kim
el 14 de Feb. de 2020
Comentada: Jaewon Kim
el 15 de Feb. de 2020
Like this figure, I would like to sort this array with result (String).
Would I use sort funtion? the cell is 256*2 cell.
Thank you for reading !
0 comentarios
Respuesta aceptada
Stephen23
el 14 de Feb. de 2020
Editada: Stephen23
el 14 de Feb. de 2020
Although the question is not very clear, I suspect that you might like to download and try my FEX submission natsortrows, which performs an alphanumeric sort on the rows of a cell array (of character vectors):
Alternatively you can simply convert the first column to double and sort that, e.g. where |C| is your cell array:
V = str2double(C(:,1));
[~,X] = sort(V);
D = C(X,:)
Note that this method only sorts by the values in the first column, the values in the second column are not taken into account.
Más respuestas (0)
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!