Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Need some improvement in the plotting values

1 回表示 (過去 30 日間)
Stefan
Stefan 2013 年 12 月 5 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
sixwwwwww
sixwwwwww 2013 年 12 月 5 日
what is 'a' here?

回答 (1 件)

sixwwwwww
sixwwwwww 2013 年 12 月 5 日
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