Sort elements in cell array in descending order
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Panos Kerezoudis
le 11 Mai 2023
Commenté : Panos Kerezoudis
le 11 Mai 2023
Hi!
I hava a cell containing three row vectors and I would like to sort each vector in descending order.
Other than using a loop, is there a way to do this with the cellfun function? bc it automatically does it in ascending order.
This is the code that I used using cellfun.
thank you!
new_cell_array = cellfun(@sort, cell_array, 'UniformOutput', false);
0 commentaires
Réponse acceptée
Stephen23
le 11 Mai 2023
fun = @(v) sort(v,'descend');
new_cell_array = cellfun(fun, cell_array, 'UniformOutput', false);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!