Plotting date and time

2 vues (au cours des 30 derniers jours)
Sahar khalili
Sahar khalili le 6 Juil 2021
Modifié(e) : Sam le 6 Juil 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?

Réponses (1)

Sam
Sam le 6 Juil 2021
Modifié(e) : Sam le 6 Juil 2021
This link should help solve your problem

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by