フィルターのクリア

Problem with dlmread()

3 ビュー (過去 30 日間)
Learner
Learner 2018 年 7 月 28 日
コメント済み: Learner 2018 年 7 月 28 日
I am reading some 1000 .txt files using dlmread function, the problem is some files may have unequal rows and columns. MATLAB is giving an error at that situation. I want to load all the files irrespective of unequal rows and columns, I don't have any problem if it made equal those rows and columns using NAN or Zero values.

採用された回答

per isakson
per isakson 2018 年 7 月 28 日
編集済み: per isakson 2018 年 7 月 28 日
That depends on the format of your txt-files.
Here is a simple case
%%R2018a
fid = fopen('rugged.txt');
cac = textscan( fid, '%f%f%f', 'CollectOutput',true, 'Delimiter',',' ...
, 'EmptyValue',nan );
fclose(fid);
and
>> cac{:}
ans =
8 1 6
3 5 NaN
4 NaN 2
where rugged.txt contains
8,1,6
3,5,
4, ,2
Upload a short sample txt-file.
  1 件のコメント
Learner
Learner 2018 年 7 月 28 日
Thank you very much @per isakson

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by