sort cell arrays based on mean value
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Amir Hosein Shokouhy
il 17 Lug 2021
Risposto: Star Strider
il 17 Lug 2021
Hi,
I have a 1*8 cell variable. I wanna sort these cells based on their mean values.

The mean valuse are as below:

Thanks,
Amir
0 Commenti
Risposta accettata
Star Strider
il 17 Lug 2021
Try something like this —
c = mat2cell(rand(150,1), [10 20 30 40 50], 1) % Create Cell ARray
[cm,idx] = sort(cellfun(@mean, c)) % Calculate & Sort By Means
c_sorted = c(idx) % Sorted Cell Array
.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!