Select part of a signal
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I have a 6xN matrix and a 1 dimension vector (made of 0 and 1) (ex: 000000000000000111110000000000.) I need to select part of the matrix, in correspondence of the "1" in the vector. (they temporally start together), and divide the selected signal in blocks.
What I have is:
DStimData = diff(round(StimData));
blockonoff = find(DStimData~=0);
%Where StimData is my "1-0" vector.
blockonoff = blockonoff(find(flagblockonoff));
trialonset = intersect(find(DStimData>0),blockonoff);
trialoffset = intersect(find(DStimData<-0),blockonoff);
t = 1;
for k = 1:length(trialonset)
onsettime = trialonset(k);
OffOnDiff = trialoffset - onsettime;
GoodOffset = trialoffset(find(OffOnDiff>0));
if ~isempty(GoodOffset),
offsettime = min(GoodOffset);
onsettime = onsettime + 1;
segmentONtime = max(1,onsettime-pretimeN);
segmentOFFtime = min(offsettime+posttimeN,size(ForceData,2));
segmentlength = segmentOFFtime - segmentONtime + 1;
On these parts of signal I apply my analysis.
Now I need an improvement: after plotting my selected signal, in some cases, I need to do the analysis again, excluding some part of the signal, even when the "1" is present. How can I be more flexible in the selection of my signal? Is there a better way also to improve the old code?
Thank You in advance
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!