How can I use datetick with more than x, y, z in input and on Y-axis?

조회 수: 2 (최근 30일)
Martinppp
Martinppp 2018년 2월 2일
댓글: Martinppp 2018년 2월 2일
Hello,
I am using datenum to convert time txt in MM:SS.FFF in serial date number. The next step is to change those numbers in MM:SS.FFF with datetick when I am ploting.
My problem is that I have more than just 3 inputs (in datetick there is just 'x','y','z' in possibilities)to put in my plot and I would like to have the time Format in Y-axis.
I have :
Format = 'MM:SS.FFF';
x= datenum(txt,Format);
x1= datenum(txt2,Format);
x2= datenum(txt3,Format);
x3= datenum(txt4,Format);
x4= datenum(txt5,Format);
plot(y,x,y,x1,y,x2,y,x3,y,x4)
datetick('x',Format,'keepticks');
datetick('x1',Format,'keepticks');
datetick('x2',Format,'keepticks');
datetick('x3',Format,'keepticks');
datetick('x4',Format,'keepticks');
So I have 2 errors in this case: x1, x2, x3, x4 are not considering in input argument and x should be in X-axis.
How can I do it with datetick or with something else from my serial numbers from datenum ?
Thank you
Martin

채택된 답변

dpb
dpb 2018년 2월 2일
Syntax for datetick is
datetick(tickaxis)
not
datetick(wanteddateaxisvariablename)
Just need
datetick('y',Format,'keepticks')
However, I'd strongly suggest unless you're running a version of Matlab prior to R2014b to convert from datenum to the datetime class. plot and friends have subsequently been made datetime aware so don't need klunky datetick any longer.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by