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.
  1 件のコメント
Martinppp
Martinppp 2018 年 2 月 2 日
Thanks a lot, I didn't understand it in that way.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by