フィルターのクリア

In a array, finding x for the first instance of y.

1 回表示 (過去 30 日間)
Jason Burke
Jason Burke 2021 年 4 月 8 日
回答済み: Star Strider 2021 年 4 月 8 日
I have a 2d array where x is time and y is result. I am trying to find the first time when y==1.

採用された回答

Star Strider
Star Strider 2021 年 4 月 8 日
Depending on what you want:
idx = find(y>=1, 1, 'first');
time = x(idx);
or:
idx = find(y>=1, 1, 'first');
time = interp1(y(idx-2:idx), x(idx-2:idx), 1);
The interpolation works if ‘y’ is not exactly equal to 1 and you want to know what that interpolated time would be.
Choose the approach that works best in the context of your problem.

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by