How to read an excel spreadsheet ignoring text and comments
4 次查看(过去 30 天)
显示 更早的评论
i'm working on a matlab app that read an excel file to get experimental data, the files i need to read have a lot of comments and text over the data, i would like to know if is possible to read a file in the same way matlab import data but by coding, detecting the columns with data and ignoring text, this is an example of the files i need to read.

0 个评论
回答(1 个)
dpb
2019-11-27
The venerable xlsread will return numeric, text, and the raw data in separate locations.
Probably better is to use the detectImportOptions utility function and then its output to read the data as a table instead.
It would be far easier if you would attach a sample file; my eyes can't begin to even read the image plus there's nothing that can be done with it....
5 个评论
Image Analyst
2019-11-28
Jorge, try his suggestion:
[numbersOnly, stringsOnly, everything] = xlsread('HPPC_18650_29dnl.xlsx');
If you look at numbersOnly, you will see it is an array where the (1,1) element is the row with the topmost number and leftmost number. Any place in that range that is a string or blank will show up as a NAN. If you have several ranges of numbers, you'll have to extract those individually from the larger matrix. Note that the indexes don't necessarily match up with the same row and column in Excel.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!