How can I use datetick with more than x, y, z in input and on Y-axis?
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 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!