Sort fieldnames in a structure alphabetically ignoring case

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??

 채택된 답변

Guillaume
Guillaume 2017년 5월 25일
[~, neworder] = sort(lower(fieldnames(yourstructure)));
newstructure = orderfields(yourstructure, neworder)
would be one way

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2017년 5월 25일

댓글:

2017년 5월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by