# How to delete all rows made out of a certain vector/array/row values from a matrix?

조회 수: 1(최근 30일)
tban 2017년 3월 10일
댓글: Guillaume 2017년 3월 10일
data=
[1 1 1 2 2 12;
2 18 5 5 5 5;
5 1 1 5 5 5;
4 11 13 2 2 12;
5 1 1 5 5 5]
... (2093 lines)
mode = [5 1 1 5 5 5]
I found a way to find the mode row. In this preview, it's [5 1 1 5 5 5]. How do I remove such rows from the matrix?

댓글을 달려면 로그인하십시오.

### 답변(1개)

data( idx, : ) = [];
will delete a row (or multiple rows), idx, from a matrix. Since you say you already have a way to find the row you want I assume this is all you are asking?
##### 댓글 수: 5표시 이전 댓글 수: 4숨기기 이전 댓글 수: 4
Guillaume 2017년 3월 10일
@Tudor, since uA is a column vector, uA(modeIdx, :) is the same as ua(modeIdx), and since modeIdx is scalar, ua(ModeIdx, :) is scalar. So modeRow is scalar, so it's totally expected that only one row is removed.
modeRow = uIdx == modeIdx;

댓글을 달려면 로그인하십시오.

### 범주

Find more on Matrices and Arrays in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by