MATLAB: How to get the index of the first non-zero element in an 1-D array in SIMULINK

findsimulink

Hi, guys
I want to find the index of the first non-zero element in a 1-D array in simulink, just like the way that 'find' command in matlab did.
For example:
x = [0 0 5 0 3 0];
idx = find(x~=0, 1, 'first');
The answer would be:
idx = 3.
So, how to do this in simulink?
Thanks!
by Ben

Best Answer

Use the Find block.
HTH,
Arnaud