How to remove the row of matrix which contains same value in specific columns?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a dataset (just a subset of a larger dataset, attached excel file). In the dataset, I want to remove the rows which have 1 in 3rd and 4th column. How can I do it in MATLAB.
0 件のコメント
回答 (1 件)
KSSV
2018 年 2 月 8 日
編集済み: KSSV
2018 年 2 月 8 日
[num,txt,raw] = xlsread('delete_one.xls') ;
num(num(:,3)==1,:) = [] ; % remove rows with one in thrid column
num(num(:,4)==1,:) = [] ; % remove rows with one in fourth column
For flottant numbers better to use:
tol = 10^-3 ;
num(abs(num(:,3)-1)<tol,:) = [] ;
num(abs(num(:,4)-1)<tol,:) = [] ;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Other Formats についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!