how to put date and time (exple 02-17-2023 06:05:34) on the x axis of a 3D plot
1 view (last 30 days)
Show older comments
Hello,
If someone can help please do.
I have date & time in a column in excel. I ploted the data (3D). X axis has date and time numbers. I want instead the actual date and time to be displayed. Example: 02-17-2023 06:05:34 intead of 7.53456 10^5).
Thank you in advance.
0 Comments
Accepted Answer
Kevin Holly
on 17 Feb 2023
Edited: Kevin Holly
on 17 Feb 2023
m = ["Jan-03-2023 06:25:12" 34 65; "Jan-04-2023 02:45:33" 56 34; "Jan-05-2023 07:05:38" 45 234]
t = array2table(m)
t.Properties.VariableNames = {'Time' 'numeric variable 1' 'numeric variable 2'}
t.Time = datetime(t.Time,"Format","MMM-dd-uuuu HH:mm:ss")
t.Time
scatter3(t.Time,double(t.("numeric variable 1")),double(t.("numeric variable 2")))
Edit: Here is another example.
t2 = table;
t2.Time = ["Jan-03-2023 06:25:12"; "Jan-04-2023 02:45:33"; "Jan-05-2023 07:05:38"];
t2.Time = datetime(t2.Time,"Format","MMM-dd-uuuu HH:mm:ss")
t2.x = [34; 56; 45];
t2.y = [65; 34; 234];
scatter3(t2.Time,t2.x,t2.y,'filled','r')
More Answers (1)
Sulaymon Eshkabilov
on 17 Feb 2023
Use readtable while importing your data into matlab and plot - see this example:
Data= readtable('DATA_Ts.csv', 'Format','%s%{dd-MM-yy HH:mm}D%f%f%s');
plot(Data.Time_Day, Data.Total, 'r-', 'linewidth', 2)
grid on
2 Comments
See Also
Categories
Find more on Bar Plots 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!