フィルターのクリア

Write a for loop that converts the Data (Data.data) in the text file into matrix of 13 by 31 or 31 by 13.

3 ビュー (過去 30 日間)
The data should be imported and converted into a matrix of 13 x 31.

採用された回答

DGM
DGM 2022 年 4 月 12 日
This should be one way:
alltext = split(fileread('Textfile.txt'),newline);
allnums = regexp(alltext(1:end-1),'(?<=:\s*)[+-E\d]+','match');
allnums = cellfun(@str2double,allnums);
allnums = reshape(allnums,13,[])
  2 件のコメント
Tunde Adubi
Tunde Adubi 2022 年 4 月 12 日
Yeah, but let it be done with a for loop.
DGM
DGM 2022 年 4 月 12 日
for k = 1
alltext = split(fileread('Textfile.txt'),newline);
allnums = regexp(alltext(1:end-1),'(?<=:\s*)[+-E\d]+','match');
allnums = cellfun(@str2double,allnums);
allnums = reshape(allnums,13,[])
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by