Alternative to cell2mat
조회 수: 8 (최근 30일)
이전 댓글 표시
I have a cell array, f with contents in it.
Is there a way to sort the contents of the cell array using
[B,IX]=sort(f) without having to use cell2mat?
I would like to evaluate it directly.
댓글 수: 1
Walter Roberson
2011년 12월 4일
Hmmm... what kind of contents? It is, for example, difficult to sort 'hello' against [18.2 13.39 9.44]
답변 (2개)
Fangjun Jiang
2011년 12월 4일
If f is a cell array of strings, you can run sort(f) directly. If you f contains numerical data, what do you try to sort of the size of data is different. You need to provide more details. And what is wrong with using cell2mat()? What is the rational for "evaluate it directly"?
댓글 수: 5
Walter Roberson
2011년 12월 4일
[IX,IX]=sortrows(cell2mat(f));
newcell = f(IX);
No mat2cell() required.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!