You can use logical indexing along with diff
function to find true
values which were preceded by ten consecutive false
values in an array as follows:
main.m543 chars17 lines
In the above code, idx_true
finds logical indices for true
values in the array. idx_false
finds logical indices for false
values which were preceded by ten consecutive false
values. Finally, indices
is an array of indices for true
values which were preceded by ten consecutive false
values.
gistlibby LogSnag