필터 지우기
필터 지우기

Removing element from two vectors by using ginput

조회 수: 2 (최근 30일)
George Lazaridis
George Lazaridis 2014년 7월 17일
Hello, i am using ginput to manually remove a peak from my plot. I have the locations of my peaks and their amplitudes in handles.R_t and handles.R_amp respectively. The following doesnt seem to work and returns empty row and columns as the maximum that I find around the neighbourhood of the click is slightly different from the value I have stored in the handles.R_t. Any help/solution or any clever ideas to avoid this problem?
[x_peak1,y_peak,button] = ginput(1);
[yy xx] = max(handles.bpf((round(x_peak1*handles.srate))-50:(round(x_peak1*handles.srate))+40));
y_peak = yy;
x_peak = xx/handles.srate + x_peak1 - 50/handles.srate;
temp1 = handles.R_t;
temp2 = handles.R_amp';
handles.R_t = zeros(1,length(temp1)-1);
handles.R_amp = zeros(1,length(temp2)-1);
viBelow = (temp1<x_peak);
viAbove = (temp1>x_peak);
newa = [temp1(viBelow) temp1(viAbove)]';
[row,column] = find(temp1 == x_peak);
Anew = zeros(1,length(temp2)-1);
Anew = temp2([1:row-1, row+1:end]);
handles.R_t = newa';
handles.R_amp = Anew;

답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by