Filter löschen
Filter löschen

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 Ansichten (letzte 30 Tage)
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

Antworten (1)

Santhana Raj
Santhana Raj am 23 Mär. 2017
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 Kommentar
FAHEEM MUSHTAQ
FAHEEM MUSHTAQ am 24 Mär. 2017
Bearbeitet: FAHEEM MUSHTAQ am 24 Mär. 2017
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by