How to replace char 'null' in number 0?
Mostrar comentarios más antiguos
Hi! I`ve got a problem with using plot function cause there is some 'null's (char type) in my data files . So i would like to change/replace that nulls in 0 (num) . Could someone help to find useful function or to offer other solution.
6 comentarios
Bizzy Dy
el 9 de Ag. de 2018
Guillaume
el 9 de Ag. de 2018
It would be much simpler to fix the way you're reading the file rather than trying to fix the problem after the fact.
For that we would need to see the code you're using (not a screenshot, an actual copy as text) and a sample file (again not a screenshot!)
Bizzy Dy
el 9 de Ag. de 2018
Guillaume
el 9 de Ag. de 2018
Please do not close questions that have been answered.
Respuesta aceptada
Más respuestas (1)
Ameer Hamza
el 9 de Ag. de 2018
0 votos
The image shows a struct which char arrays as fields. You can use strrep() to replace the elements of a char array. Although it will still not work with the plot() function because the elements are char arrays, not numeric values. You might need to use str2num() to convert char values t numeric before using plot().
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!