Reading an Array in scientific notation from a txt

42 ビュー (過去 30 日間)
simone martinelli
simone martinelli 2017 年 1 月 8 日
編集済み: Stephen23 2017 年 1 月 8 日
Hi, I am trying to read the data from a txt file but I have been so far unable to manage to extract it using fscanf or textread. i need to start after the row ''pt 8644 ...etc''.
the file is formatted as follows:
  1 件のコメント
Stephen23
Stephen23 2017 年 1 月 8 日
編集済み: Stephen23 2017 年 1 月 8 日
Do not upload screenshots of data. These are useless for us. We cannot import a screenshot. We have no way to test code with a screenshot. We cannot tell if your data file uses tabs, or space characters, or what end-of-line characters it uses, or anything else about the file. Because a screenshot is not your data.
Please upload data in its original form by clicking the paperclip icon.

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2017 年 1 月 8 日
編集済み: Stephen23 2017 年 1 月 8 日
MATLAB's textscan reads E-notation numbers perfectly:
fid = fopen('temp5.txt','rt');
C = textscan(fid,'%f%f','HeaderLines',6);
fclose(fid);
Which correctly read all E-notation values in the file to import this numeric data:
>> C{1}
ans =
0
0.1
2.02
>> C{2}
ans =
0
0.00146
0.00591
Because you did not provide any sample data file I created my own, available at the link below:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by