Does available funtion in Matlab can extract rows satisfied a condition?
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to create a matrix has rows has first column value = 4 from matrix a; like
Does available funtion in Matlab can extract rows satisfied a condition? Thanks so much!
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 9월 28일
편집: Ameer Hamza
2020년 9월 28일
Read about array indexing: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html and https://www.mathworks.com/help/matlab/math/array-indexing.html
a = [4 5 6;
4 5 6;
5 5 6];
idx = a(:,1)==4;
b = a(idx, :);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!