Plotting date and time

2 views (last 30 days)
Sahar khalili
Sahar khalili on 6 Jul 2021
Edited: Sam on 6 Jul 2021
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?

Answers (1)

Sam
Sam on 6 Jul 2021
Edited: Sam on 6 Jul 2021
This link should help solve your problem

Categories

Find more on MATLAB 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!