Replacing repeated values in each row with zero
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matrix A:
A=[ 2 4 6 7 8 9 10 28 6 9 10 11;
2 4 6 7 8 9 10 28 10 21 22 24]
and I want to delete any repeated element in each row. The result should be as:
A=[ 2 4 6 7 8 9 10 28 0 0 0 11;
2 4 6 7 8 9 10 28 0 21 22 24]
Any idea? Thanks
0 件のコメント
回答 (1 件)
Image Analyst
2017 年 1 月 7 日
Why do you want to do this? Is it homework? Are all A integers, or can they have fractional parts? Have you considered using histcounts() and look for numbers where the count is more than 2?
参考
カテゴリ
Help Center および File Exchange で Graphics Object Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!