How to remove apostrophes from empty cells when using readtable
Mostra commenti meno recenti
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.

Risposta accettata
Più risposte (1)
Image Analyst
il 22 Mag 2023
0 voti
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.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!