how to sort an array based on a specific column and display it in another array
Mostrar comentarios más antiguos
i have attached below an array named sector1 and want to sort the array based on the last column and display the type of the first element (minimum) after sorting as 'cm' and others as 'ch' as other column in same array

3 comentarios
dpb
el 9 de Dic. de 2015
Please paste the text of the input arrays rather than the image so folks can do something with it including being able to read it w/o excess gyrations) and then explain more clearly the desired output. I don't understand what the last phrase about 'cm/ch' is intended to say.
sneha sharma
el 10 de Dic. de 2015
sneha sharma
el 10 de Dic. de 2015
Respuestas (1)
[~,idx] = sort(sector1(:,end));
and use the index variable idx to sort whichever other variables you wish to.
Categorías
Más información sobre Shifting and Sorting Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!