Watch this Author's files
This function has problems with consecutive equal values. They are also counted as crossings.
lc_fast([0;1;1;1;1;1;0],1) ans = 4
I would expect for the example above: 1
Contact us at files@mathworks.com