Finding a value in a column from a change in another column in a matrix?

1 回表示 (過去 30 日間)
Matilde Garcia
Matilde Garcia 2015 年 12 月 2 日
コメント済み: Matilde Garcia 2015 年 12 月 3 日
Given the matrix below:
1.1586 0.9381 3.0000
1.2265 0.6906 3.0000
1.2765 0.5432 3.0000
1.3266 0.4243 2.9999
1.3766 0.3302 2.9999
1.4267 0.2565 2.9997
How can I write the code which gives me the value in column 1, corresponding to the point in which column 3 changes from 3.0000 to 2.9999?

採用された回答

Thorsten
Thorsten 2015 年 12 月 3 日
編集済み: Thorsten 2015 年 12 月 3 日
ind = X(:,3) == 3.0 & [abs(abs(diff(X(:,3))) - 1e-4) < 1e-10; 0]
X(ind,1)
or
ind = X(1:end-1,3) == 3.0 & X(2:end,3) == 2.9999;
X(ind, 1)

その他の回答 (1 件)

Eng. Fredius Magige
Eng. Fredius Magige 2015 年 12 月 3 日
編集済み: Eng. Fredius Magige 2015 年 12 月 3 日
Hi Use for in association with find function looking exact Nii_Ni=0.0001; note the last and first N need some manipulation, this could be controlled by if else

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by