how do i find a column in a matrix that satisfies a condition for all rows

2 ビュー (過去 30 日間)
Casper Stroem
Casper Stroem 2017 年 9 月 28 日
コメント済み: Stephen23 2017 年 9 月 28 日
Hi I am trying to find the power output of my windturbine less than P=2500000 I am interested in the last column where the max power is less than 2500000 but as close as possible I have found the answer by using the find(P<2500000)
but i am looking for a way to code this so matlab gives me a column number

回答 (1 件)

KSSV
KSSV 2017 年 9 月 28 日
idx = find(P<2500000) ;
iwant = idx(end) ;
  2 件のコメント
Matt J
Matt J 2017 年 9 月 28 日
編集済み: Matt J 2017 年 9 月 28 日
If that's what the OP wants, it would be more direct to do,
iwant=find(P<250000,1,'last');
Stephen23
Stephen23 2017 年 9 月 28 日
Casper Stroem's "Answer" moved here:
it does not give me the value i am looking for.
by using find(P<2500000) it shows the last column that is less than 2500000 is column 40
Columns 22 through 42
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1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 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
can I get matlab to find column 40 in the matrix?

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by