Selecting data from an imported table
15 ビュー (過去 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!