How to rearrange row of a matrix based on column value
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
sazzad hossen
el 2 de Ag. de 2017
Comentada: sazzad hossen
el 2 de Ag. de 2017
I have a matrix v=[1 1 7 35; 2 1 27 55; 3 1 5 50] I would like to rearrange the based on the the 4th column maximum value in chronological order new matrix will be like v=[2 1 27 55; 3 1 5 50; 1 1 7 35]
0 comentarios
Respuesta aceptada
Image Analyst
el 2 de Ag. de 2017
Try this:
[~, sortOrder] = sort(v(:,4), 'descend')
v2 = v(sortOrder,:)
Más respuestas (0)
Ver también
Categorías
Más información sobre Elementary Math 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!