Read text file with string
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Guillaume
le 4 Mar 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);
Catégories
En savoir plus sur Text Files dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!