Plotting date and time

2 次查看(过去 30 天)
Sahar khalili
Sahar khalili 2021-7-6
编辑: Sam 2021-7-6
Hello,
I have a cell which contains date and time.
zenithtime =
'11-Jul-2020 13:57:00'
'12-Jul-2020 13:57:00'
'13-Jul-2020 13:57:00'
14-Jul-2020 13:57:00'
'15-Jul-2020 13:57:00'
'16-Jul-2020 13:57:00'
'17-Jul-2020 13:57:00'
'18-Jul-2020 13:57:00'
'19-Jul-2020 13:57:00'
'20-Jul-2020 13:57:00' ....
I seperate the date and the time.
t = datetime(zenithtime);
v = datevec(t);
Var1 = datetime(v(:,1:3));
Var2 = duration(v(:,4:end));
var1='11-Jul-2020'
'12-Jul-2020'
'13-Jul-2020'
'14-Jul-2020'
'15-Jul-2020'
'16-Jul-2020'
'17-Jul-2020'
'18-Jul-2020'
'19-Jul-2020'
'20-Jul-2020' .....
var2 = '13:57:00'
'13:57:00'
'13:57:00'
'13:57:00'
'13:57:00'
'13:57:00'
'13:57:00'
'13:57:00'
'13:57:00'
'13:57:00' .....
Now I want to plot the date and the time.
plot (var1,var2)
But I face this error "Unrecognized function or variable 'var1'."
Does anyone know how can I fix it?

回答(1 个)

Sam
Sam 2021-7-6
编辑:Sam 2021-7-6
This link should help solve your problem

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by