How can i replace a string to a numeric value in a specific column of an array ?
4 views (last 30 days)
Show older comments
I have a data set od cancer diagnosis and the data has a column of strings B and M for benign and malignant cancer cells(for 'n' no.of patients). I want to replace the letters with 0s and 1s. Is there a function in matlab to do this replacing? If no can someone help with the code. Would be much appreciated!
0 Comments
Answers (1)
Star Strider
on 24 Oct 2021
Try this —
column = ['M';'B';'M';'M';'B';'B']
g = findgroups(column)-1
.
0 Comments
See Also
Categories
Find more on Classification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!