How to delete the same element in matrix?

1 回表示 (過去 30 日間)
win
win 2013 年 5 月 15 日
i have a matrix
if true
B = input('enter the element to delete(enter any one 1,2,5,8,6,)= ')
A = [1 2 5 8 6];
end
When i enter any one of the number in the input, then delete that element in the matrix. how can i do please help.

採用された回答

Jan
Jan 2013 年 5 月 15 日
編集済み: Jan 2013 年 5 月 15 日
A(A==B) = [];
or
A = A(A ~= B);
  2 件のコメント
win
win 2013 年 5 月 15 日
thank youuuuuuuuuu
Jan
Jan 2013 年 5 月 15 日
You are welcome. You have seen, that this answer took 3 hours. But such fundamental methods are explainbed exhaustively in the Getting Started chapters of the documentation. I suggest to read them, because you will get the wanted answers much faster then.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by