Removing elements from matrix
2 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
I was wonderning is there an easy way to remove some of the elemetts from matrix. I have a data array data(300x2) and I want to remove all rows that have the value in the second column smaller than 0.18.
I tried something like
data=data(data(:,2)<0.18);
and similar combinations but it doesn't work.
Thank you in advance for any advice you can offer.
2 件のコメント
harsha
2014 年 8 月 5 日
hi
i have a 49x49 matrix and i want to delete the single element at center of the matrix.how can i do so?please help.
Julia
2014 年 8 月 5 日
What do you mean with delete? Set to 0? You can delete the row or the column containing the element, but you cannot create a hole in the middle of the matrix.
採用された回答
Andrei Bobrov
2012 年 5 月 14 日
data=data(data(:,2)>=0.18,:);
ADDED after Marin's comment
simple example
data1 =[...
2 3
5 8
10 3
4 6
6 7]
data2 =[...
9 2
10 2
6 3]
data1(ismember(data1(:),data2(:))) = nan
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!