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.
2 ビュー (過去 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
0 件のコメント
回答 (1 件)
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
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!