Selecting data from an imported table
조회 수: 13 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!