sort cell arrays based on mean value
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2021년 7월 17일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!