grpstats for non-numerical data
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello Reading the grpstats documentation I realized I can easily count the number of elements that meet 2 conditions like this ( From matlab documentation):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197641/image.jpeg)
My data is not numeric and a similar command results in an error. How can I count the number of elements that has D_S='0-30' & the damage rate is 'No Damage' ? My table is attached below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/197642/image.jpeg)
The first thing that comes to my mind is to substitute the strings with numbers, but I think there is better way! Thank you
댓글 수: 0
답변 (1개)
dpb
2018년 10월 11일
Convert those variables to categorical which is what they are, really, not string. Then, internally to Matlab, they are numerical but the interface is still human-readable.)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!