필터 지우기
필터 지우기

is it possible to detect the repeated values using modulo operator (mod 16) of a matrix and replace the repeated mod value with the range from 0-15? Please explain.

조회 수: 3 (최근 30일)
Suppose we have a matrix A=[7871,5995,3451,5583;7151,5093,3251,5485;3227,5835,7647,5295;3475,5253,7375,5773] and its modulo: Mod(A,16)= [15,11,11,15;,15,5,3,13;11,11,15,15;3,5,15,13] The number 15,11,5,3,13 is repeated. I want help, if we take mod 16, the resultant matrix check the 2nd element with 1st and simultaneously 3rd element with previous two and vice versa, if repeated value appear then replace the others than repeated value between the range of 0-15. The resultant matrix contain all unique element of range 0-15. How can we do it? Thanks

답변 (1개)

Santhana Raj
Santhana Raj 2017년 3월 23일
Hi,
You can use the command unique. Go through the documentation.
Another way is to use find. After getting the mod array, check for each element to be repeating and replace it with [].you can use a single line command using find.
Hope it helps.
Raj
  댓글 수: 1
FAHEEM MUSHTAQ
FAHEEM MUSHTAQ 2017년 3월 24일
편집: FAHEEM MUSHTAQ 2017년 3월 24일
Hi, Can you explain the code, how i find the repeat element location and replace automatic between the range 0-15. Suppose this is our matrix A= [15,11,11,15;,15,5,3,13;11,11,15,15;3,5,15,13], how we identify the repeated element in A and replace the range element on exactly location. Please explain the sequence of cammands/code. Thank you.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by