Cannot overlay new plot on an existing subplot
Mostrar comentarios más antiguos
I cannot believe that I have been forced to ask this question, but your help would be greatly appreciated!
I generate a plot (figure(10) of three subplots, all are hold on
I use ginput(2) to fidentify portion of good data in subplot(3,1,1) from which I need to detect peak points using a custom function that uses the built in function findpeaks
I want to mark over the original data in figure(10), subplot(3,1,1) the detected peak points
When I run the program, the overwrite either goes to a new figure or if figure(10) is selected it kills the previous figure(10) and plots a new figure(10) showing only the detected points
input data arrays are IABP, PPG and ECG (They are too long to provide here, approximately 40,000 points each)
The simplified code snippet is below;
% Select good data for determination of BP parameters
figure(10)
orient Landscape;
set(gcf,'units', 'normalized', 'outerposition', [0 0 1 1]);
%==========================================================================
ax(1)=subplot(3,1,1);
plot(IABP,'b'), hold on
v1=axis;
ylabel('IABP'), hold on
%--------------------------------------------------------------------------
ax(2)=subplot(3,1,2);
plot(ECG, 'k'), hold on
v2=axis;
ylabel('ECG'), hold on
%--------------------------------------------------------------------------
ax(3)=subplot(3,1,3);
plot(PPG,'k'), hold on
v3=axis;
ylabel('PPG'), hold on
%--------------------------------------------------------------------------
[x,y]=ginput(2); % Select good area of data
x=round(x);
% Create BP data from IABP segment
BP=IABP(x(1):x(2));
%==========================================================================
% Calculate SBP, DBP and MP
[DBP_LOCS,DBP,SBP_LOCS, SBP,HR] = IABP_PulseDetect(Fs,1,BP,LookbackBP); % Calculates SBP and DBP peaks, uses findpeaks
figure(10) % Want to locate detected SBP points and DBP points on figure(10) subplot(3,1,1)
subplot(3,1,1)
scatter(SBP_LOCS, SBP,'ro'), hold on
scatter(DBP_LOCS,DBP,'go'), hold on
axis([v1(1) v1(2) v1(3) v1(4)])
%linkaxes(ax,'x')
hold on
pause
%--------------------------------------------------------------------------
Can provide code for function, IABP_PulseDetect, but any figures opened in that subroutine are closed before exiting function.
I find MATLAB incredibly useful and love using it, but sometimes why something does not work can consume an extraordinary amount of time.
I thank you for your assistance!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Labels and Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!