필터 지우기
필터 지우기

determing if number is in row of matrix

조회 수: 1 (최근 30일)
Filipa Cardoso
Filipa Cardoso 2018년 4월 18일
답변: KSSV 2018년 4월 18일
I have a matrix that represents an interval and i also have a number (x). the first column of the matrix represents the beginning of the interval and the second one represents the end. my goal is to determine if the x is between any of the numbers of the matrix. how can i do that?
matrix=[100 130;150 230; 250 270; 275 285; 290 315]
x= 225

채택된 답변

KSSV
KSSV 2018년 4월 18일
matrix=[100 130;150 230; 250 270; 275 285; 290 315] 
x= 225 ;
idx = matrix(:,1)<=x & matrix(:,2)>=x 
iwant = matrix(idx,:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by