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

カテゴリ

Find more on Dates and Time 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!

Translated by