I am trying to plot a signal and use a scrollbar on the x-axis to view several hours worth of data

11 次查看(过去 30 天)
I would like to be able to use the uicontrol to update the figure as I scroll with the timestamp information on the x-axis. Also, I would like to be able to access the data as it is updated in order to generate a linked spectorgram of the data in a separate plot beneath the signal. This would allow me to scroll through the time-stamped data and view the spectogram of the data as I scroll through. So far I have only been able to create a scrollbar that allows me to scroll through my data with a specified window size in seconds on the x-axis. Besides adding the time-stamps I still need to access the data in the plot as it is updated by moving the scrollbar. The uicontrol handle is empty for some reason and I can not access the data currently displayed in the time window. Below is the function I have created so far.
function [] = SlidingWindowPlot(Signal,Fs,WindowSize)
a=gca;
t=0:1/Fs:(length(Signal)-1)/Fs;
p=plot(t,Signal);
set(gcf, 'windowstyle', 'docked', 'color' ,'w'); set(gcf,'doublebuffer','on'); grid on
set(a,'xlim',[0 WindowSize]); set(a,'ylim',[-5 5]);
pos=get(a,'position'); Newpos=[pos(1) pos(2)-0.1 pos(3) 0.05];
tmax=max(t); S=['set(gca,''xlim'',get(gcbo,''value'')+[0 ' num2str(WindowSize) '])'];
h=uicontrol('style','slider',... 'units','normalized','position',Newpos,... 'callback',S,'min',0,'max',tmax-WindowSize);

回答(1 个)

Frantz Bouchereau
Frantz Bouchereau 2017-3-17
编辑:Frantz Bouchereau 2017-3-17
Hi Nicholas, have you tried the Signal Analyzer app? It allows you to visualize long signals and pan through them in the time and frequency domain. See more here: https://www.mathworks.com/help/signal/ug/getting-started-with-signal-analyzer-app.html
Thanks Frantz

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by