Trouble with textread function

3 ビュー (過去 30 日間)
Xinping
Xinping 2013 年 5 月 14 日
I am trying to use textread but have encountered error msg as below:
[B,spc]=textread('DOTP.txt', '%f %f')
Error using dataread Trouble reading floating point number from file (row 1, field 1) ==>
Error in textread (line 176) [varargout{1:nlhs}]=dataread('file',varargin{:});
This is how my txt file looks like:
2800 -787.957031
2800.977539 -787.957031
2801.955078 -781.957031
2802.932617 -772.957031
2803.910156 -773.957031
2804.887695 -787.957031
2805.86499 -778.957031
2806.842529 -785.957031
What can I do to read the file? Thanks.

採用された回答

Yao Li
Yao Li 2013 年 5 月 14 日
I've tried your codes with Matlab 2013a and it works well. What's your current release of Matlab?
  2 件のコメント
Yao Li
Yao Li 2013 年 5 月 14 日
編集済み: Yao Li 2013 年 5 月 14 日
Also try
fileid=fopen('DOTP.txt');
C=textscan(fileid, '%f %f');
fclose(fileid);
Xinping
Xinping 2013 年 5 月 14 日
Thanks a bunch! All I needed was to use a different computer! :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by