フィルターのクリア

problem with slider to move the plot

2 ビュー (過去 30 日間)
Olga
Olga 2012 年 1 月 3 日
Hello, I'm writing a project for analizing HRV. In my GUI I'm loading the ECG signal and donig the QRS detection. I've got problem with making a slider to move the plot of ECG. The whole signal is about 10 minutes long, but the plot shows only first 20 seconds. What should I do to make it possible to see though the plot? Is a slider a good idea? Maybe sombody could give me some tips on how to handle the problem?
  1 件のコメント
Robert Cumming
Robert Cumming 2012 年 1 月 3 日
show some of your code and you will get a better response

サインインしてコメントする。

回答 (1 件)

Matt Tearle
Matt Tearle 2012 年 1 月 3 日
You could make a slider to control the zoom level of the x-axis, if that's what you mean:
t = linspace(0,10);
y = t.*cos(t);
hf = figure;
ha = axes('position',[0.1,0.2,0.8,0.7]);
plot(ha,t,y)
hs = uicontrol(hf,'units','normalized','position',[0.1,0.05,0.8,0.05],...
'style','slider','max',100,'value',100,'min',10);
cb = @(hobj,edata) set(ha,'xlim',[0,0.1*get(hs,'value')]);
set(hs,'callback',cb)
In practice, of course, you'd probably want a bit more code in the callback, so you should write a proper function to do this, rather than this one-line function handle.
EDIT TO ADD: So you mean more like a scroll wheel? Same principle, just change the callback
t = linspace(0,100,501);
y = t.*cos(t);
hf = figure;
ha = axes('position',[0.1,0.2,0.8,0.7]);
plot(ha,t,y)
set(ha,'xlim',[0,10])
hs = uicontrol(hf,'units','normalized','position',[0.1,0.05,0.8,0.05],...
'style','slider','max',9,'value',0,'min',0);
cb = @(a,b) set(ha,'xlim',[0,10]+10*get(hs,'value'));
set(hs,'callback',cb)
  1 件のコメント
Olga
Olga 2012 年 1 月 3 日
It's not what I mean. I don't need to zoom the signal with the slider. I want to be able to move along the signal with the slider so that I can see all of the data loaded into the program, not only first 60 seconds.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeECG / EKG についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by