how to put date and time (exple 02-17-2023 06:05:34) on the x axis of a 3D plot
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Kevin Holly
2023-2-17
编辑:Kevin Holly
2023-2-17
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')
更多回答(1 个)
Sulaymon Eshkabilov
2023-2-17
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!