Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to remove rows include a specific array

조회 수: 4 (최근 30일)
Alex Rob
Alex Rob 2017년 5월 11일
마감: MATLAB Answer Bot 2021년 8월 20일
Assume matrix A as follows:
A = [
12 3 1 6 1 8 10
12 10 3 2 4 9 6
12 5 10 3 9 1 9
14 6 5 4 5 6 5
14 8 4 7 3 7 10
14 10 3 7 1 9 3
16 1 5 3 6 3 6
16 6 4 9 8 5 6
98 4 10 1 5 7 9
98 10 1 4 3 1 8
98 8 8 4 6 1 9
98 5 3 6 10 3 3
98 3 2 6 5 5 9
];
I want to create matrix B where remove any rows in the second column of matrix A if array is equal by 10.
B = [
12 3 1 6 1 8 10
12 5 10 3 9 1 9
14 6 5 4 5 6 5
14 8 4 7 3 7 10
16 1 5 3 6 3 6
16 6 4 9 8 5 6
98 4 10 1 5 7 9
98 8 8 4 6 1 9
98 5 3 6 10 3 3
98 3 2 6 5 5 9
];

답변 (1개)

Steven Lord
Steven Lord 2017년 5월 11일
Use logical indexing as part of the technique described in the "Delete Matrix Rows and Columns" section on this documentation page.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by