フィルターのクリア

hot to add time label to a plot of coordinate

10 ビュー (過去 30 日間)
MarFanta
MarFanta 2017 年 1 月 29 日
コメント済み: MarFanta 2017 年 1 月 30 日
Hi I have lat and log with time (mm:ss) I would like to make 2d plot(lat,long) and add a time label to each point (in mm:ss format). Any idea how to get it? thank you

採用された回答

MarFanta
MarFanta 2017 年 1 月 29 日
scatter(X,Y);
labstr=datestr(T,'hh:mm:ss');
text(X,Y,labstr,'HorizontalAlignment','right');

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 1 月 29 日
text() the time label giving the coordinates of the point.
For example, with HH and MM being the vectors of the hours and minutes,
labstr = arrayfun( @(hh, mm) sprintf( '%02d:%02d', hh, mm), HH, MM, 'uniform', 0);
text( lat(:), long(:), labstr, 'HorizontalAlignment', 'right')
That should draw all of the labels at the same time.
  3 件のコメント
Walter Roberson
Walter Roberson 2017 年 1 月 29 日
The problem with saying that the vector T contains time(MM:SS) is that you did not describe the datatype of T. Is it a cell array of character vectors? Is it a string array (R2016b or later)? Is it a vector of datetime() objects? Is it a vector of datenum? Is it a vector where the integer portion is the number of hours and the decimal part is fraction of hours?
MarFanta
MarFanta 2017 年 1 月 30 日
Sorry I will be more precise next time

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

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by