Extracting rows based based on criteria from two columns

조회 수: 2 (최근 30일)
Mido
Mido 2016년 11월 4일
답변: KSSV 2016년 11월 4일
A= [1 1 4;
1 2 6;
1 3 9;
1 4 10;
2 1 12;
2 2 15;
2 3 20;
2 4 45]
I want to extract rows from the matrix as follows: For each consecutive number in the first column extract rows using increment of 2 in the second column. The result will be:
A= [1 2 6;
1 4 10;
2 2 15;
2 4 45]

채택된 답변

KSSV
KSSV 2016년 11월 4일
iwant = A(2:2:end,:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by