readtable() on a csv is bringing in "missing" values when its a letter but reads fine when its a number
18 ビュー (過去 30 日間)
So im a bit frustrated with tables. There seems to be many many bugs with this data type.
So im using read table to read in a csv.
The csv has cells that contain either letters or numbers or a mix
When i first open the csv and do the read table everything comes in fine.
numbers show up as numbers, letters show up as letters
however, if i edit the csv file and take a cell that once had numbers in it and replace it with lettes and do the read again i get "missing" data saved into the table
My code continues to break because matlab is not reliably reading the table correctly. I dont know what to do about this.
Does anyone have any ideas?
回答 (2 件)
Image Analyst 2021 年 7 月 24 日
csvread() reads an array of all numbers.
readtable() can read numbers and characters/strings but all items in a single column must be of the same type. Different columns can be different types though, like one column of numbers and another with strings.
readcell() is probably what you want. It can put anything into any cell. All rows and columns do not have to match like they do with tables or arrays. tables are not meant to have variables change type within a column on a row-by-row basis -- the whole column must have the same type.
For a good intuitive description of what cell arrays are and how they work, read the FAQ:
Finally, please give a specific example of a true bug in a table, as you have not done that yet.