How can I remove successive repeated numbers (column wise) from a matrix?

1 回表示 (過去 30 日間)
Viswanath V
Viswanath V 2020 年 12 月 6 日
コメント済み: Ameer Hamza 2020 年 12 月 6 日
For example If I have a matrix like this
A = [11 35 57 45 94;
26 45 69 45 86;
58 45 39 96 35;
87 59 64 56 45]
The output should be a column vector (i have just showed transpose of it)
[11 26 58 87 35 45 59 57 69 39 64 45 96 56 94 86 35 45]'
I have tried to use unique() function but, the output it gives is
[11 26 58 87 35 45 59 57 69 39 64 96 56 94 86]'

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 12 月 6 日
編集済み: Ameer Hamza 2020 年 12 月 6 日
Easy peasy
A = [11 35 57 45 94;
26 45 69 45 86;
58 45 39 96 35;
87 59 64 56 45]
B = A(:);
or
B = reshape(A, [], 1)
  6 件のコメント
Viswanath V
Viswanath V 2020 年 12 月 6 日
Oh, I am extremely sorry! I had made a mstake in my code.
Thank you very much.
Ameer Hamza
Ameer Hamza 2020 年 12 月 6 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by