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

조회 수: 12 (최근 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)
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