フィルターのクリア

How to import data from a txt file that has 256 arrays and 128 data points per array into a 128x256 matrix?

1 回表示 (過去 30 日間)
I have data in a txt file that I would like to import into Matlab for further analysis.
The file has val(:,:,1), val(:,:,2), and so on all the way to val(:,:.256) and each array contains 128 data points.
I want to import these data so that it’s in a 128x256 (column x row) matrix.
The first line of all the arrays contain a scientific notation that must be multiplied by the following cells in that array.
For example, the frst line of val(:,:,256) is 1.0e-08 * followed by 128 data points.
I tried using the load command and it outputs an error message.
I also tried using importdata, which isn’t working either.
What can I do to import this data into a 128x256 matrix? (Please see attached for the txt file).
  1 件のコメント
C B
C B 2021 年 10 月 11 日
val(:,:,1) =[...
...
1.0e0 *...
...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i]...
val(:,:,2) =[...
...
1.0e0 *...
...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i...
0.0000 + 0.0000i]...

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

採用された回答

KSSV
KSSV 2021 年 10 月 11 日
編集済み: KSSV 2021 年 10 月 11 日
filename = 'SeqLoop.data.kSpaceOS.txt' ;
fid = fopen(filename,'r') ;
S = textscan(fid,'%s','delimiter','\n') ;
fclose(fid) ;
S = S{1} ;
S = str2double(S) ;
idx = isnan(S) ;
S = S(~idx) ;
S = reshape(S,128,[]) ;
  3 件のコメント
KSSV
KSSV 2021 年 10 月 11 日
Yes you are right...I forgot to add that line. Now edited the answer.
parslee
parslee 2021 年 11 月 15 日
The first line of all the arrays contain a scientific notation that must be multiplied by the following cells in that array.
How can I implement this in the coding?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by