Filter rows based on presence of string
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a 100 x 1 vector called 'gender'. There are only two values in the vector: 'male' and 'female'. These are string values. I want to convert 'gender' to a binary variable with 'male' as '1' and female as '0'.
How do I go about this?
Any help would be appreciated.
댓글 수: 0
답변 (2개)
Star Strider
2020년 11월 8일
If you have R2015b or later use the findgroups function. Otherwise, use the third output of the unique function to do the same thing.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!