How to count the number of letter case changes in a string array
조회 수: 2 (최근 30일)
이전 댓글 표시
If i had a string like 'hfeHDdheD' for example. The case changes 3 times. How would i get matlab to take any string and have it tell me how many case changes there are?
I thought maybe I could have it be into a logical array of upper and lower case but i'm not sure how to count when it changes from 0 to 1 and then 1 to 0
댓글 수: 0
답변 (1개)
madhan ravi
2020년 11월 8일
편집: madhan ravi
2020년 11월 8일
c = 'hfeHDdheD';
nnz(diff(ismember(c, 'A':'Z')))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!