How to find the index of the first non-zero element in a 2-D array in simulink?

1 回表示 (過去 30 日間)
Ahmed Desoky
Ahmed Desoky 2016 年 4 月 11 日
I want to find the index of the first non-zero element in a 2-D array in simulink, just like the way that 'find' command in matlab did.
For example:
u1 = [46.15 61.21; 22.5 45.3; -1 -1; -1 -1; -1 -1];
idx= find(u<0, 1)-1 The answer would be: idx= 2

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by