extract and store valuable data in vectors
Mostra commenti meno recenti
I have a signal (vector) consists of many blocks (for example five blocks).I want to extract, separate, these blocks (that contain a valuable information ) from the main signal and store every block in a vector. This is real data and the 5 valuable information in the example are not always in same location.
For example like:

So if I have an input vector (V), The result , in our case, should be five mini vectors (v1, v2, v3, v4, v5).
I tried to apply this method: If a specific consecutive elements from (V) vector have a value above a threshold (for example 0.02 > Thr) start put the elements in a a mini vector, but it does not work because values in the input vector (V) are getting positive and negative.
Risposta accettata
Più risposte (1)
What about using the absolute value of V?
T = (abs(V) > Thresh);
blockStart = strfind(T, [false, true]);
blockEnd = strfind(T, [true, false]);
But even then the signal can have a value below the threshold during a block.
[EDITED]
T = (abs(V) > Thresh);
% To fill gaps with less than e.g. 3 frames:
[B, N, Idx] = RunLength(T);
gap = find((B == false) & (N < 3)); % Two frames
T(gap) = true;
T(gap+1) = true;
blockStart = strfind(T, [false, true]) + 1;
blockEnd = strfind(T, [true, false]);
% Split signal into blocks:
Block = cell(1, length(blockStart));
for k = 1:length(BlockStart)
Block{k} = V(blockStart(k):blockEnd(k));
end
Categorie
Scopri di più su Scopes and Data Logging in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
