How to replace char 'null' in number 0?
Show older comments
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 Comments
Bizzy Dy
on 9 Aug 2018
Guillaume
on 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
on 9 Aug 2018
Guillaume
on 9 Aug 2018
Please do not close questions that have been answered.
Accepted Answer
More Answers (1)
Ameer Hamza
on 9 Aug 2018
0 votes
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().
Categories
Find more on Design of Experiments (DOE) 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!