How to skip lines while loading text (.txt) files ?

3 Ansichten (letzte 30 Tage)
zghsryfkmgcbg
fnmfmn fhmfmfjmfm njdmf
ddgjd
fgjnfm nm ncncgn
fhjmvbnmvnmhgmfh
fnmhm
fdhmdtmgkmuykmnf
fjrykj fjryjtukmfryfk
ghugfhjgkjhklhfjfgjfjfh
_1_ 3454
_2_ 4667
_3_ 5645
_4_ 4564
_5_ 76457
_6_ 4574
_7_ 46574
_8_ 6574
_9_ 746
_10_ 4
_11_ 47568
_12_ 578
_13_ 87
_14_ 56
_15_ 36
_16_ 473
_17_ 636
_18_ 3
_19_ 56
  3 Kommentare
Md Fakhra Alam Faisal
Md Fakhra Alam Faisal am 27 Jan. 2018
1 3454
2 4667
3 5645
4 4564
5 76457
6 4574
7 46574
8 6574
9 746
10 4
11 47568
12 578
13 87
14 56
15 36
16 473 17 636
18 3
19 56
Here i want like two columns
Stephen23
Stephen23 am 27 Jan. 2018
Is the number of header lines always the same?"
Does the numeric data really have underscores around it?
(note: it would be much simpler if you just uploaded a sample file).

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Md Fakhra Alam Faisal
Md Fakhra Alam Faisal am 27 Jan. 2018
Thanks a lot, @Stephen Cobeldick I've found the solution. The problem was simply skipping some header line and read the rest body by two column. here the script now I am using
AAA = fopen('XXX.txt', 'rt'); % File Name XXX.txt
BBB = textscan(AAA, '%f %f', 'HeaderLines',9); % To skip 9 Header line
Column_1=BBB {1,1};
Column_2=BBB {1,2};

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by