Plot the timestamp versus data from excel file
조회 수: 1 (최근 30일)
이전 댓글 표시
I would like to plot the timestamp in the x-axis and the data in the y axis using plot command. I have written the below code to achieve this. But i have some issue.
1) As shown in the plot(Attached timestampplot.png) the starting timestamp 12:38:06:001 why doesn't start right at the origin? why the timestamps are not having equal intervals? why timestamp 12:38:06:003 is not visible although it has only 10 points?
2) How can i zoom in and see more resolution between two timestatmps?
=====Codestarts here===========================
[num,txt,raw] = xlsread('Test1.xlsx');
time = vertcat(txt{2:end,1}) ;
data = num(:,1) ;
starttime = datenum(time(1,:),'HH:MM:SS:FFF');
endtime = datenum(time(end,:),'HH:MM:SS:FFF');
xData = linspace(starttime,endtime,size(time,1));
plot(xData,data,'-*','color','g')
datetick('x','HH:MM:SS:FFF','keepticks','keeplimits');
=====Codeend here=============================
댓글 수: 0
답변 (1개)
Mahesh Taparia
2019년 10월 4일
Hi Suresh,
It looks like datetick function does not have a precision of millisecond while converting datenum object back to date format. May be that’s the reason of inconsistency in the graph.
Also, you can always normalize the data if you want the graph to start at origin.
Hope it helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!