Import an oddly shaped txt file

1 Ansicht (letzte 30 Tage)
ayat
ayat am 29 Mär. 2016
Beantwortet: KSSV am 29 Mär. 2016
I have a txt file that is with a weird shape as you can see in the attached. When I use the import feature in matlab and choose nemeric matrix, the imported matrix looks like it should (each value allocated to the correct number on the second row). I don`t know how to replicate that in code. On a side note, is it possible to replace the "," with "." and then import?

Antworten (1)

KSSV
KSSV am 29 Mär. 2016
clc; clear all ;
file = 'B00001.txt' ;
fid = fopen(file,'r') ;
S=textscan(fid,'%s','delimiter','\n');
fclose(fid) ;
S = S{1} ;
All the file contents will be saved in cell S. You can do what ever you want from S.
Note that there are many other ways to read a file.

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by