How can I plot this X and Y data?
Show older comments
Hi coders!
I have a very simple data (Data is attached as a .mat file) set but I want to know the most efficient way of plotting it.
I have a few tide height (m) data and I want to plot this in an hour-based manner. In X axis, I want to keep hours (00:00, 01:00, .... 23:00, 24:00) and in Y-axis, I want to keep the heights. The data is in a table format and given below -
'00:00' 0.820000000000000
'01:00' 1.11600000000000
'01:48' NaN
'02:00' 1.23800000000000
'03:00' 1.11400000000000
'04:00' 0.799000000000000
'05:00' 0.428000000000000
'06:00' 0.106000000000000
'07:00' -0.0750000000000000
'07:18' NaN
'08:00' -0.0330000000000000
'09:00' 0.178000000000000
'10:00' 0.413000000000000
'11:00' 0.646000000000000
'12:00' 0.936000000000000
'13:00' 1.23000000000000
'14:00' 1.39400000000000
'14:30' NaN
'15:00' 1.33300000000000
'16:00' 1.06400000000000
'17:00' 0.704000000000000
'18:00' 0.363000000000000
'19:00' 0.101000000000000
'19:54' NaN
'20:00' -0.00200000000000000
'21:00' 0.0770000000000000
'22:00' 0.222000000000000
'23:00' 0.369000000000000
'00:00' 0.589000000000000
'01:00' 0.898000000000000
'02:00' 1.16400000000000
'03:00' 1.23200000000000
'04:00' 1.04800000000000
'05:00' 0.698000000000000
'06:00' 0.330000000000000
'07:00' 0.0420000000000000
'07:48' NaN
'08:00' -0.0820000000000000
'09:00' 0.0220000000000000
'10:00' 0.262000000000000
'11:00' 0.491000000000000
'12:00' 0.711000000000000
'13:00' 0.990000000000000
'14:00' 1.26400000000000
'15:00' 1.38800000000000
'15:12' NaN
'16:00' 1.27300000000000
'17:00' 0.959000000000000
'18:00' 0.586000000000000
'19:00' 0.259000000000000
'20:00' 0.0410000000000000
'20:30' NaN
'21:00' 0.00500000000000000
'22:00' 0.136000000000000
'23:00' 0.292000000000000
Any feedback from you will be greatly appreciated!! <3
Accepted Answer
More Answers (1)
It's unclear to me exactly what you want to plot. That file has 10,048 data points.
Here is one possibility, which puts a dot at each time point, with the time (but not the date) on the x-axis. Or, did you want to only plot a segment of the data, but not have data from different dates in the same column?
load("Tide_Data.mat")
plot(datetime(Tide_info.Time_GMT_,"InputFormat","HH:mm"),Tide_info.Predicted_m_,'.')
1 Comment
Ashfaq Ahmed
on 27 Jan 2023
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


