Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Mapping signal segments to it's signal

2 visualizaciones (últimos 30 días)
JA
JA el 25 de Jul. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have an algorithm which chops the signal based on some parameters and stores it in a structure.
Code:
classdef Container < handle
properties
segments = struct('signal', {}, 'time', {});
end
methods
function this = addsignal(this, varargin)
interval = diff(varargin{2});
[~, locations] = findpeaks(interval,'THRESHOLD',0.7)
edges = [0; locations; numel(varargin{1})+1]; %note that 0 and one past the end is on purpose
newsegments = struct('signal', cell(numel(edges)-1, 1), 'time', cell(numel(edges)-1, 1), 'error', []);
%this loop works for no peaks, 1 peak and more than one peak (because of the 0 and numel+1)
for edgeidx = 1 : numel(edges) - 1
newsegments(edgeidx).signal = varargin{1}((edges(edgeidx)+1 : edges(edgeidx+1)-1));
newsegments(edgeidx).time = varargin{2}(edges(edgeidx)+1 : edges(edgeidx+1)-1);
end
this.segments = [this.segments; newsegments]; %and append structure
end
this is how i call this fucntion:
f = ltifilter.container(); % ltifilter is a package
f.addsignal(signal1,time1);
f.addsignal(signal2,time2);
f.addsignal(signal3,time3);
When i call with all signals, segments structure will have all the chopped segments of all the signal combined, there is no way of saying which segment belongs to which signal, i want to map the segments to it's parent signal like this:
Any suggestion will be helpful

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by