Sort fieldnames in a structure alphabetically ignoring case
조회 수: 8 (최근 30일)
이전 댓글 표시
I have a struct. I used orderfields to sort the fieldnames. But it is case sensitive. I am getting Upper case first then the lower case. Is there a way I can sort the fieldnames alphabetically ignoring the case??
댓글 수: 0
채택된 답변
Guillaume
2017년 5월 25일
[~, neworder] = sort(lower(fieldnames(yourstructure)));
newstructure = orderfields(yourstructure, neworder)
would be one way
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!