vector array in matlab
조회 수: 2 (최근 30일)
이전 댓글 표시
assume i have folllowing vector column named as ALT_digit_
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/890540/image.png)
i want to know the number of times 'hi' comes in the vector column.
댓글 수: 0
채택된 답변
추가 답변 (2개)
Adam Danz
2022년 2월 10일
편집: Adam Danz
2022년 2월 10일
댓글 수: 1
Adam Danz
2022년 2월 10일
If your only string values are 'hi' 'lo' or '' and your Matlab release is R2016b or later, this solution is perfectly fine. But if you're using a release prior to 16b or combinations of 'hi' and 'lo', consider using a different method.
Image Analyst
2022년 2월 10일
Yes another way : using ismember():
ALT_digit = {'lo', '', '', '', 'lo', '', '', '', 'lo', '', 'abc'}
rows = ismember(ALT_digit, 'lo')
count = sum(rows)
댓글 수: 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!