Conditional marker on stream time series data plotting
1 view (last 30 days)
Show older comments
I like to mark in a stream time series data when data value equals to a threshold. Whenever such value is reached in a streaming time series plot the marker will appear and then streaming will go on with the marker. I have modified code from http://www.mathworks.in/matlabcentral/answers/87466-real-time-plot-from-streaming-data as:
t = 0 ; x = 0 ; startSpot = 0; interv = 1000 ; % considering 1000 samples step = 0.1 ; % lowering step has a number of cycles and then acquire more data while ( t <interv ) b = sin(t)+5; x = [ x, b ]; plot(x) ; if ((t/step)-500 < 0) startSpot = 0; else startSpot = (t/step)-500; end axis([ startSpot, (t/step+50), 0 , 10 ]); grid t = t + step; drawnow; pause(0.01) end
But this is not working as intended????
1 Comment
Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!