Problem reading excel data, unknown format
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Carlo
el 4 de Mzo. de 2018
Respondida: Star Strider
el 4 de Mzo. de 2018
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 comentarios
Respuesta aceptada
Star Strider
el 4 de Mzo. de 2018
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!