Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Need some improvement in the plotting values

1 vue (au cours des 30 derniers jours)
Stefan
Stefan le 5 Déc 2013
Clôturé : MATLAB Answer Bot le 20 Août 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.
  1 commentaire
sixwwwwww
sixwwwwww le 5 Déc 2013
what is 'a' here?

Réponses (1)

sixwwwwww
sixwwwwww le 5 Déc 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

Cette question est clôturée.

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by