Import data from text file and delete blank rows, columns, headers and unnecessary values

2 ビュー (過去 30 日間)
Tuan-Cuong Nguyen
Tuan-Cuong Nguyen 2020 年 6 月 10 日
回答済み: Rik 2020 年 6 月 10 日
I would like to import useful data only, particularly a 12x11 matrix from the first columns with 12-row zeros to the last columns with 12-row zeros, into Matlab. However my original data file has a lot of blank columns, rows, headers, etc. Can anyone help me in this problem. Thank you very much.
  1 件のコメント
Rohith Nomula
Rohith Nomula 2020 年 6 月 10 日
Try storing it in a table that way you can remove the headers and NaN

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

回答 (1 件)

Rik
Rik 2020 年 6 月 10 日
T=readmatrix('data.txt','NumHeaderLines',4);
T(:,1)=[];%remove row indices in first column

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by