How to remove apostrophes from empty cells when using readtable
Ältere Kommentare anzeigen
I used readtable to import a csv file and any blank cells, including non-blank cells following, are automatically filled with apostrophes or have apostrophes surrounding a value. With the apostrophes surrounding a value I am not able to plot them. I was wondering what the best way is to either completely get rid of the apostrophes (converting to NaN) or how to make it so they only affect blank cells, and not the cells following.

Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 22 Mai 2023
0 Stimmen
Why are you trying to plot them? Shouldn't you just use table2array to extract the numbers and plot only the numbers (shown in the lower part of your table)? Also, you forgot to attach your table. In a table, all items in a table column must be of the same type. Since your columns mix numbers and strings, it made everything a string since that is the only type that would work for every item in the column. Maybe you should tell readtable to skip some lines (via the NumHeaderLInes option) in your file to avoid that problem. Then everything would be numbers. Of course we can't try anything because you forgot to attach your data file.
Kategorien
Mehr zu Cell Arrays 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!