필터 지우기
필터 지우기

How to select some part of a matrix ?

조회 수: 9 (최근 30일)
Rita
Rita 2016년 9월 8일
댓글: mbonus 2016년 9월 8일
Hi,I have a matrix with two column I would like to select data from the second column based on the condition that I put for the first column.for example if I have
A=[ 32 5
38 4
43 6
49 3
53 13
59 34
61 2
64 23]
and I want to have this
if 43<A(:,1)<59 then give me the numbers of second column which are 3 and 13.(with the same row)
Thanks a lot

채택된 답변

mbonus
mbonus 2016년 9월 8일
b = A(:,1) > 43;
c = A(:,1) < 59;
d = b & c;
result = A(d,2)
  댓글 수: 3
Rita
Rita 2016년 9월 8일
Thank you so much for your help.
mbonus
mbonus 2016년 9월 8일
Glad to help

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by