Find the first value that is greater than or equal to and its corresponding value

12 ビュー (過去 30 日間)
Athul Nath M K
Athul Nath M K 2022 年 9 月 27 日
回答済み: Chunru 2022 年 9 月 27 日
A table from an .txt file is imported. It looks like this (say first column as x and second as y)
0.01 3
0.02 4
0.03 6
0.04 9
0.05 12
0.06 14
0.07 15
0.08 18
How to find the first value in column y that is greater than or equal to 10 and find the corresponding x value (PS: Both x and y are increasing as it goes down)

採用された回答

Chunru
Chunru 2022 年 9 月 27 日
data =[
0.01 3
0.02 4
0.03 6
0.04 9
0.05 12
0.06 14
0.07 15
0.08 18];
idx = find(data(:,2)>=10, 1, 'first')
idx = 5
x = data(idx, 1)
x = 0.0500

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by