フィルターのクリア

Extract, save, plot three specific columns from huge txt file

1 回表示 (過去 30 日間)
LuYao Guo
LuYao Guo 2021 年 2 月 17 日
コメント済み: KALYAN ACHARJYA 2021 年 2 月 17 日
Hi,
I meet a problem about extracting columns from a huge txt file, and what I want is using textscan to extract column 1, 3 and 8 as a new txt file. Then I try to plot them in subplot, the column 1 as x axis and column 3 and 8 become y1 and y2. However, I ended up with error:
Index in position 1 exceeds array bounds (must not exceed 1)
I understand that Matlab treat the whole file as one column, anyone could help me with some codes please? Thank you very much.

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 17 日
Any issue?
data=readmatrix('test.txt');
Now Extract the clolumns as
data(:,2); % For 2nd Column
data(:,3); % For 3rd Column
....so on
plot(...)
  2 件のコメント
LuYao Guo
LuYao Guo 2021 年 2 月 17 日
Hi Sir, first of all, thank you for answering. Unfortunately I fail to use readmatrix. And I realize the last three columns involves 'E' '-' and time, are they the reasons causing the error?
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 17 日

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

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by