How to replace char 'null' in number 0?
Ältere Kommentare anzeigen
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 Kommentare
Bizzy Dy
am 9 Aug. 2018
Guillaume
am 9 Aug. 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
am 9 Aug. 2018
Guillaume
am 9 Aug. 2018
Please do not close questions that have been answered.
Akzeptierte Antwort
Weitere Antworten (1)
Ameer Hamza
am 9 Aug. 2018
0 Stimmen
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().
Kategorien
Mehr zu Whos finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!