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일
If A is your matrix....to remove first column.
A(:,1) = [] ;

댓글 수: 8

I tried this already and I got, "matrix index is out of range for deletion."
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
Attach one text file here or attach the data DataIn1. It seems you are not getting a matrix.
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
data = importdata(myfile) ;
data = data.data ;
data(:,1) = [] ;
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.
Can you tell ...how
data = importdata(myfile) ;
looks like?
Also read about readmatrix, textscan.
data = importdata(myfile); is shown above in the original question.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops 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