Imagine that you have a very long sequence I break what is the most efficient way of finding where the sequence is all zeros (or more precise order allows near-zero values for simplicity, assume the following sequence: abs (X) & lt; eps ): < Code> sig = [1 1 0 0 0 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0];
I'm trying to get the following information:
startIndex EndIndex period 3 6 4 12 12 1 14 16 3 25 26 2 30 30 1 Then using this information, we find the interval with the term = = (say 3 ) with certain values, and all these intervals The returns of values in return are combined:
index = [3 4 5 6 14 15 16]; This last part is related to the previous question:
It is so far to me:
sig = [1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0]; Lane = length (sig); Threshold = 3; Align the signal transferred to a% # V sequentially in% #, so in the starting positions of zero interval = 1 (1, lane-threshold + 1) 1; I for = 1: thresh v = v & amp; (CIG (I: Lane-Threase + I) == 0); End of the end% # 1 I = 1: thresh-1 v (find (v) +1) = true; End% # get the last index v = search (v); I am looking to create / customize the code vectors, but I'm open to other solutions. I have to stress that the space and time capacities are very important, because I am processing a large number of bio-signals for a long time.
These are the steps I take to solve your problem in a vector, which that is a certain vector sig : to
-
code first, a vector to vector zero and zero <> tsig For thresholds (for zero where the absolute value of zero is left to zero, elsewhere):
tsig = (abdomen (sig)> = eps); % # To use EPS as threshold Previous>Next, the first index, the index finished, and duration of each string using the functions zero Search and
dsig = diff ([1 shi 1]); StartIndex = Search (DCIG & lt; 0); EndIndex = Search (DCIG> 0) -1; Period = endindex-startIndex + 1; After that, find the value of zero equal to or equal to some value (such as 3, by your example):stringIndex = (period> = 3); StartIndex = startIndex (stringindex); And index = and index (string idx); Finally, to generate the last set of your index, use:index = zero (1, max (end index) + 1); Index (startindex) = 1; Index (Andindex + 1) = Index (And Indic + 1) -1; Index = search (cumsum);
Comments
Post a Comment