How can i replace a string to a numeric value in a specific column of an array ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 24 de Oct. de 2021
Try this —
column = ['M';'B';'M';'M';'B';'B']
g = findgroups(column)-1
.
0 comentarios
Ver también
Categorías
Más información sobre Classification en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!