Matrix of date and number to plot

I have a array matrix of only 2 columns: 1st col is all date (datenum), 2nd col is all number. If I would like to plot a graph that y-axis is number and x-axis is datestring like (03-Mar-2011), should I convert the array matrix to cell matrix? and convert the datenum to string by datedisp?

 採用された回答

David Young
David Young 2011 年 3 月 5 日

4 投票

It's simpler just to leave the data as it is and use datetick to set the axis annotations on your graph. Like this:
plot(data(:,1), data(:,2));
datetick('x', 'dd-mmm-yyyy');

2 件のコメント

Paulo Silva
Paulo Silva 2011 年 3 月 5 日
you are correct, +1 vote
Hello Blower
Hello Blower 2011 年 3 月 6 日
thank a lot

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および 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