フィルターのクリア

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 Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by