Filter rows based on presence of string
6 ビュー (過去 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 で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!