Removing non duplicate values from a matrix

조회 수: 7 (최근 30일)
James Wright
James Wright 2016년 11월 13일
댓글: Jan 2016년 11월 14일
Hello,
I have a matrix which is 12x10. Each column has most of the values the same as the other columns however some columns have values which aren't in the other columns. I want matlab to look at a value, compare it with the rest of the columns and then if its seen at least 3 times, keep it, if not remove it.
I tried using a loop, if statement and the any function. However i was not able to do it.
Thank you very much for any help
  댓글 수: 3
James Wright
James Wright 2016년 11월 13일
1. Sorry about that.
1.1 1.1 1.1 1.1
1.7 1.4 1.7 1.5
1.9 1.7 1.9 1.7
2.1 1.9 2.1 1.9
Something like that, as you can see 1.4 and 1.5 aren't repeated, i want to get rid off them.
2. Matrix form
Thank you!
Jan
Jan 2016년 11월 14일
@James: As long as you cannot assure that all columns have the same length after the "getting rid", you cannot create the output as a matrix. So please post, what you expect as output for the posted input.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2016년 11월 14일
What does "get rid of" mean to you. Keep in mind that all columns in a matrix must have the same length and all rows must have the same length. So for example you can't just remove 1.4 and 1.5 since row 2 would have only 2 elements while other rows would have 4 elements. You can't do that. You can't have ragged edges on matrixes. You can set them to zero or something but you can't just remove/delete/get rid of them.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by