How to delete the same element in matrix?

조회 수: 3 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by