How to replace a string with another string in a Matlab table
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
JFz
el 27 de Ag. de 2015
Comentada: Ashishkumar Gupta
el 7 de En. de 2023
Hi,
I have a table that has 'N/A' in some of the column cells. I want to replace 'N/A' by ''. Would anyone tell me how to do that?
Thanks,
Jennifer
0 comentarios
Respuesta aceptada
Walter Roberson
el 28 de Ag. de 2015
Example:
t.Var1(strcmp(t.Var1,'N/A')) = {''};
6 comentarios
Stephen23
el 7 de En. de 2023
Editada: Stephen23
el 7 de En. de 2023
"Please provide some code/hint to remove it"
Rather than removing them, the best approach is to avoid them in the first place (hint: as Walter Roberson already wrote, you can use the READTABLE options, e.g. TreatAsMissing). If you clicked the paperclip button to upload a sample data file then someone could probably help you with that.
Ashishkumar Gupta
el 7 de En. de 2023
Thanks @Stephen23, Treatasmissing worked....I did not know the exactword to write in readtable(), that's y could not understand @Walter Roberson.
Now it worked!!
Más respuestas (1)
Image Analyst
el 27 de Ag. de 2015
Look at the isnan() function and I'm sure you'll find the way.
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!