Read text file with string
Mostrar comentarios más antiguos
Hi all,
I have to read the file (inserted in attachment) and only need the numeric portion as a matrix(array). The extension of file is .TXK .
Thanks in advance
Respuesta aceptada
Más respuestas (1)
Guillaume
el 4 de Mzo. de 2020
Should work in R2016a:
filename = 'My2.TXK'; %using full path would be better
[fid, errmsg] = fopen(filename, 'rt');
assert(fid > 0, 'Failed to open "%s" due to error: %s', filename, errmsg);
data = cell2mat(textscan(fid, '%f%f%f', 'Delimiter', {'\t', ' '}, 'MultipleDelimsAsOne', true, 'HeaderLines', 1));
fclose(fid);
Categorías
Más información sobre Text Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!