Deleting multiple rows based on a specific condition
6 ビュー (過去 30 日間)
古いコメントを表示
Stefania Avvedimento
2021 年 2 月 28 日
コメント済み: KALYAN ACHARJYA
2021 年 2 月 28 日
Hi all,
I am working on a water network. I got a big matrix 381x12527 (time vs node's quality concentration) even for times that I am not interest in. So I want to delete the matrix rows for which the difference between two consecutive rows is not equal to 3600 (see yellow rows in Figure).
I would appreciate if anyone could help me, thanks!
Stefania
0 件のコメント
採用された回答
KALYAN ACHARJYA
2021 年 2 月 28 日
編集済み: KALYAN ACHARJYA
2021 年 2 月 28 日
Lets say data1 is the column time data
diff_data=diff(data1);
idx_delete=find(diff_data~=3600)+1;
% +1 for compensate with next
% Do modify accordingly
Once get the rows numbers, which to be deleted
matrix(idx_delete,:)=[]
Or:
matrix(~mod(data1,3600)==0,:)=[]
It gives the all those numbers, which are non divisible by 3600
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!