File processing dat file returns error

1 回表示 (過去 30 日間)
NALLARASU KRISH
NALLARASU KRISH 2024 年 2 月 26 日
コメント済み: NALLARASU KRISH 2024 年 2 月 26 日
I have a dat file iris.dat containing Iris dataset. I wants to remove fifth column from the file by using the code below. But i received error "Variable index exceeds table dimensions". data variable in workspace shows 0x0 table. How to get rid off the error? I tried to upload the dat file here, but the MathWorks site not supported. I have attached the ss of what the dat file contains.
filename = 'iris.dat';
data = readtable(filename, 'Delimiter', ',');
% Remove the fifth column
data(:, 5) = [];
  1 件のコメント
VBBV
VBBV 2024 年 2 月 26 日
編集済み: VBBV 2024 年 2 月 26 日
Rename to txt file and try to upload the file

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

回答 (1 件)

VBBV
VBBV 2024 年 2 月 26 日
data.Var5 = [];
  1 件のコメント
NALLARASU KRISH
NALLARASU KRISH 2024 年 2 月 26 日
Your idea of converting the dat file to txt file worked. After removing 5th column i created new dat file through my program. This new dat file is accepted by matlab so that i am able to remove more columns.
Now i have another question. I got error when i tried to process downloaded dat file, but worked fine for matlab created dat file. What is the reason behind it?

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

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by