Selecting data from an imported table

13 Ansichten (letzte 30 Tage)
Juanita Pombo
Juanita Pombo am 27 Sep. 2019
Beantwortet: dpb am 27 Sep. 2019
I uploaded a large excel spreadsheet on matlab using the import tool. The data has not been cleaned up and I need to be able to write a script that allows me to delete the remaining non useful data. I was thinking of using an if statement that will allow me to delete all the data when the difference between two consecutive values in the same column is larger that a certain value. For example, all my values are between 2000 and 3000, and suddenly, there is a large drop to 20. So I'm wanting to delete all columns and rows after that large drop.

Antworten (1)

dpb
dpb am 27 Sep. 2019
Presuming the data array is variable array x and it's the first column to explore...
x=xlsread('yourfile.xls');
ix=find(diff(x:,1)<-1000); % look for a large drop; save that location
x=x([1:ix],:); % save only those locations
If this occurs in multiple columns and not necessarily the same row in each, then you can no longer keep the data in an ordanary double array; you would have to either convert locations from the offending location to NaN or other "bad data" indicator or use cell array to store each column.

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by