Problem reading excel data, unknown format
3 次查看(过去 30 天)
显示 更早的评论
I have a sample of data from a bigger one in excel (attached), I tried with this lines of code to read the data (I need to work with the numeric values), I know they are special characters since they have a blank space before the numeric str, I tried the next but in doesn't work, any ideas?
[num,txt,raw] = xlsread('data.xls', '1', 'A1:N8'); x=(strtrim(char(txt(1,7))))% it should give '14' but still gives ' 14'
thanks
0 个评论
采纳的回答
Star Strider
2018-3-4
It’s not a ‘normal’ space (char(32)). It’s a ‘nonbreaking’ space, (char(160)).
Use strrep to replace it with a ‘normal’ space:
txt = strrep(txt, char(160), char(32));
x=(strtrim((txt(1,6))));
Then, it works.
0 个评论
更多回答(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!