Removing a particular column from multiple large datasets.

I am importing multiple large datasets to carry out analysis. One of the columns in each imported file is preventing me from analysis carrying out analysis.
I want to remove that column (In my case it's column 1) from all of the datasets. Multiple files are being imported at once using a test list.
for i = length(testlist.data)
DataIn1 = importdata([FolderINPUT1 '\' FilesList1(testlist.data(i,1)).name], '\t' );
end
I want to remove all of column 1 for every file which has been imported, can anyone help me with this?

回答 (1 件)

KSSV
KSSV 2020 年 10 月 12 日

0 投票

If A is your matrix....to remove first column.
A(:,1) = [] ;

8 件のコメント

Eoin Lyden
Eoin Lyden 2020 年 10 月 12 日
I tried this already and I got, "matrix index is out of range for deletion."
Eoin Lyden
Eoin Lyden 2020 年 10 月 12 日
That's if If I put it inside the for loop. When I use it outside the for loop i get an error further down that says " expected one output from a curly brace or doit indexing expression, but there were 0 results.
I know that the piece of code on the line where the error is coming from is correct, as it's working for another dataset(for some reason it doesn't have the problematic column). As a result I've concluded it must be due to an error in DataIn1
KSSV
KSSV 2020 年 10 月 12 日
Attach one text file here or attach the data DataIn1. It seems you are not getting a matrix.
Eoin Lyden
Eoin Lyden 2020 年 10 月 12 日
I can't send in the full file, I'll attach a screenshot.
The time column has been dealt with, I removed that further up, it's the next column in is causing me problems, In particular, when it changes from 0 to 0x7
KSSV
KSSV 2020 年 10 月 12 日
data = importdata(myfile) ;
data = data.data ;
data(:,1) = [] ;
Eoin Lyden
Eoin Lyden 2020 年 10 月 12 日
Thank you for your help. I am now getting an error saying that dot indexing cannot be used for this new variable further down in the code.
KSSV
KSSV 2020 年 10 月 12 日
Can you tell ...how
data = importdata(myfile) ;
looks like?
Also read about readmatrix, textscan.
Eoin Lyden
Eoin Lyden 2020 年 10 月 12 日
data = importdata(myfile); is shown above in the original question.

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

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2020 年 10 月 12 日

コメント済み:

2020 年 10 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by