Azzera filtri
Azzera filtri

can someone tell me how can i read this text file?

1 visualizzazione (ultimi 30 giorni)
hello i have text file . i am trying to read it read it but not getting the results.
endarcfmt = ['%s', repmat('%f64',1,4)]
fid = fopen('half.txt','r');
dc = textscan(fid, arcfmt, 'HeaderLines', 1, 'Delimiter', '\t', 'EmptyValue', uint8(0), 'CollectOutput', 1)
fclose(fid);
160a01184201c500 3.63392E+18 6.04919E+18 7.30445E+18
160a011842034200 3.63392E+18 6.04919E+18 7.30445E+18
160a01184204f700 3.63392E+18 6.04919E+18 7.30445E+18
160a01184209c800 7.17463E+18 7.63062E+16 4.97705E+18
160a0118421bcb00 3.63392E+18 6.04919E+18 7.30445E+18
160a0118421bcc00 3.63392E+18 6.04919E+18 7.30445E+18
160a011842376000 1.59888E+18 4.90256E+18 8.61872E+18
160a0118423b6400 8.67273E+18 6.735E+18 3.26382E+18
160a0118424ecd00 8.67273E+18 6.735E+18 3.26382E+18
160a0118424ece00 8.67273E+18 6.735E+18 3.26382E+18
160a0118424f3200 8.67273E+18 6.735E+18 3.26382E+18
160a0118424f4e00 8.67273E+18 6.735E+18 3.26382E+18
160a0118424f6a00 8.67273E+18 6.735E+18 3.26382E+18
160a0118424f7000 8.67273E+18 6.735E+18 3.26382E+18
160a0118424f7300 2.06908E+18 8.49562E+17 8.23739E+18
160a0118424f8d00 8.67273E+18 6.735E+18 3.26382E+18
160a0118424fb700 2.06908E+18 8.49562E+17 8.23739E+18
160a0118424fb800 2.06908E+18 8.49562E+17 8.23739E+18

Risposta accettata

Walter Roberson
Walter Roberson il 18 Ott 2016
It appears to be
dc = textscan(fid, arcfmt, 'HeaderLines', 1, 'Delimiter', '\t', 'MultipleDelimsAsOne', true, 'CollectOutput', 1);
This will only work if there are no missing column entries. If there are missing column entries then it gets complicated to try to figure out when the multiple tabs are there to make things pretty, and when there are there to indicate that the value is not present.
  11 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by