Selecting data from an imported table

15 ビュー (過去 30 日間)
Juanita Pombo
Juanita Pombo 2019 年 9 月 27 日
回答済み: dpb 2019 年 9 月 27 日
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.

回答 (1 件)

dpb
dpb 2019 年 9 月 27 日
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.

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by