how to use read a Huge .txt file row by row and save each row as a vector?

1 回表示 (過去 30 日間)
congcong
congcong 2015 年 10 月 28 日
コメント済み: KSSV 2017 年 6 月 22 日
I have a huge .txt file (435483 rows), each row contains 60 measured values (at 60 time points). Now, I want to read this file into 435483 separate arrays and each array contains these 60 measured values. My data looks like this:
row1:1 2 3 4 5;
row2:2 4 6 8 10;
row3:1 3 5 7 9;
...
But instead of having three rows, I have (435483 rows); instead of having 5 measured-values, I have 60.
At the end, I want to acquire 435483 arrays v_1, v_2, ...v_435483. I know that textscan() can do similar thing, but they group elements in each col instead of row.
Thank you very much for whoever can help!
  3 件のコメント
congcong
congcong 2015 年 10 月 29 日
編集済み: congcong 2017 年 6 月 22 日
Thank you for your comments! yes, that does not sound very smart to acquire each vector individually. I finally give up using textscan and used importdata ("...txt") instead and question is solved. Thank you!
KSSV
KSSV 2017 年 6 月 22 日
load also works...

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by