我從這些Matlab plot graph(segment by segment) and user input threshold value before writing to txt和Matlab load entire file but show and plot segment by segmentMATLAB繪圖表(只顯示>閾值)
我的任務是繪製圖形和顯示的高峯節點滿足條件後,新的問題(這些是>閾值),但只管理繪製的節點,它是被困在這裏:
我試圖繪製出來這是什麼PIC節目,但我有困難:
這裏是我的代碼:
for e = 1:size(rows,1),
%plot normal graph first, hold it before plotting nodes
%so that it is combined
figure,plot(rows(e,:)), hold on;
%put the 'INPUT' statement outside the loop, or it will be evaluated
%multiple times (every time all the other conditions are true)
threshold = input('Key in the threshold value to use: ');
% loop over this if statement to find peaks in this row
for k = 2 : 999
if (rows(e,k) > rows(e, k-1) && rows(e,k) > rows(e,k+1) && rows(e,k) > threshold)
beat_count = beat_count + 1;
peaks(beat_count)=rows(e,k);
peak_x(beat_count) = k + 1000 * (e - 1);
plot(rows(e,peak_x(beat_count)),'ro');
end
end
%pop up text to plot new segment
fprintf(1, 'press any key to continue!\n');
% pause, on keypress go to next plot
pause;
end
% since peaks array keeps growing, we should print it out all at once:
fprintf(fid, 'the following peaks were found:\n');
for ii = 1:beat_count
fprintf(fid, 'x = %d; peak = %f\n ', peak_x(ii), peaks(ii)); %open writer
end
fclose(fid); % close the file once you're done
我有3個問題,實際上,但我想通過1來解決它1所以第1會
繪製圖形和顯示峯值節點
'O'
與那些超過用戶輸入的閾值 (我設法繪製峯值'O'
,但它們都卡在1個位置)由於圖正在分割成每個
1000
,是否可以增加x軸上的值?像第一個圖從0
到1000
,第二個圖將從1001
到2000
等等,直到數據的整個長度。允許從他們要開始,比如我可以在一個重視關鍵,所以我會從
3001
密謀4000
取其段的用戶輸入,以後每次在閾值I鍵將輸出寫入到文本文件而不是將所有輸出全部寫入文本文件。 (如果有什麼差錯中途發生,則需要重新一切,所以這是從重複整個流程,以防止如果事情中途發生,我可以從我停止開始,太)