Time on X-axis
조회 수: 16 (최근 30일)
이전 댓글 표시
I'm and trying to plot real time data in MatLab and I am having trouble determining how to go about putting time on the x-axis. I tried working with 'datenum', but it seems like to use this you would need a predetermined time.
For example I want to see something like 7:30:25 for each tick..
Can this function be used? Would a different function work better to continually update and plot real time?
Thank you
댓글 수: 0
답변 (3개)
Wayne King
2012년 2월 28일
After calling plot() with datenum()
use datetick
datetick('x','HH:MM:SS')
For example:
x = linspace(now, now+1, 12*6+1);
% Create a sample plot
plot(x, (1:length(x)).^2);
datetick('x', 'HH:MM PM')
댓글 수: 3
Wayne King
2012년 2월 28일
can you give a simple example of your time vector, say 10-20 elements of it and the data. So we can do an example
Steve
2012년 2월 29일
댓글 수: 1
Walter Roberson
2012년 2월 29일
Time = sprintf('%02d:%02d:%02d', c(4), c(5), c(6));
What do you get in the command window if you execute
datestr(linspace(now, now+1, 12*6+1),'HH:MM PM')
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!