Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Need some improvement in the plotting values

1 Ansicht (letzte 30 Tage)
Stefan
Stefan am 5 Dez. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Hello, I made this
for i=1:500:4500
if (i<3900)
k1=a(i:i+499,1);
fignum = figure('Units', 'norm', 'Position', [.2 .2 .7 .7],'name','Simple Pulse Meter');
thisax = axes('Units', 'norm', 'Position',[0.1 0.2 0.8 0.5]);
box1 = uicontrol('Style', 'text', 'Units', 'norm', 'Position', [.3 .8 .15 .05], 'String', 'Pulsescounted','fontsize',15);
box2 = uicontrol('Style', 'text', 'Units', 'norm', 'Position', [.45 .8 .15 .05]);
plot(k1,'-r','Parent', thisax);
set(box2, 'string', sprintf('%d', peaks),'fontsize',15);
drawnow();
else
break;
end;
end;
and I am getting evrything as I need but the plots are being displayed in different figures like first 500 values are being displayed in one figure and next 500 in another figure and so on.
1)How to make the current 500 values plot to display in a single figure clearing the previous plot.
2)Also need another method of plotting like 1000 values in a figure instaed of every 500 values plot and if new 1000 values are available then plot them on the same figure clearing the previous plot.
can anyone help me out in solving the issue. Thanks.

Antworten (1)

sixwwwwww
sixwwwwww am 5 Dez. 2013
Dear Stefan, try this:
count = 1;
k2 = 0;
for i=1:500:4500
if (i<3900)
k1 = a(i:i+499,1);
if mod(count, 2) == 0
k2 = [k2, k1];
cla
% fignum = figure('Units', 'norm', 'Position', [.2 .2 .7 .7],'name','Simple Pulse Meter');
thisax = axes('Units', 'norm', 'Position',[0.1 0.2 0.8 0.5]);
box1 = uicontrol('Style', 'text', 'Units', 'norm', 'Position', [.3 .8 .15 .05], 'String', 'Pulsescounted','fontsize',15);
box2 = uicontrol('Style', 'text', 'Units', 'norm', 'Position', [.45 .8 .15 .05]);
plot(k2,'-r','Parent', thisax);
set(box2, 'string', sprintf('%d', peaks),'fontsize',15);
drawnow();
k2 = 0;
else
k2 = [k2, k1];
end
else
break;
end;
count = count + 1;
end

Diese Frage ist geschlossen.

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by