checking that at least one value in a row of a matrix is greater than zero

I have a 2D matrix, T. I am interested in writing an "if" statement where the decision is made if at least one value in the bottom row of T (excluding the last m+1 columns) is less than zero. hoping someone could help me with the decision statement. thanks!!
For instance, when
T = [12 -4 1 3 10; 14 -6 1 2 1; 12 -4 1 3 10; 12 -4 1 3 14]
m = 2
the values 12 and -4 would be checked.

回答 (1 件)

David Young
David Young 2011 年 4 月 5 日
if any(T(end, 1:end-(m+1)) < 0)
% actions
end

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2011 年 4 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by