Formatting exel import in readtable()
9 次查看(过去 30 天)
显示 更早的评论
I have an excel file with char arrays and numerical data. I import the data using readtable(). I want all the data to be homogeneous, that is either all or none of them as cell array. Currently i import the table and search through the table and change the type using num2cell(). Is there a better way to import all the columns as cell arrays irrelavent of whether they are a string/double?
Edit: Attached is the file I want to load into matlab. I have columns of string and numbers(or num arrays). But it could be that some columns can be completely empty. If the entire column is empty, readtable reads the missing values as NaN (type: double). If one or more values is present in a column, then readtable read the missing values as {'0x0 char'}. I wanted to remove this ambiguity.
0 个评论
采纳的回答
Star Strider
2022-10-3
It would help to have the Excel file to experiment with.
2 个评论
Star Strider
2022-10-6
As always, my pleasure!
An interesting solution!
I did not see the Excel file until just now. It seems as though you solved the problem, however if you need more help with it I will do what I can.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!