Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

# Need some improvement in the plotting values

1 visualizzazione (ultimi 30 giorni)
Stefan il 5 Dic 2013
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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 CommentoMostra NessunoNascondi Nessuno
sixwwwwww il 5 Dic 2013
what is 'a' here?

### Risposte (1)

sixwwwwww il 5 Dic 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

### Community Treasure Hunt

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

Start Hunting!

Translated by