MATLAB: How to plot a table with dates

MATLABplottable

Hi! I am trying to plot a table, this is a short snippet of it:
date CountryA CountryB CountryC
_____ _______ _______ _______
2020-01-01 {[ 17]} {[ 18]} {[ 12]}
2020-01-02 {[ 15]} {[ 13]} {[ 16]}
2020-01-03 {[ 20]} {[ 15]} {[ 16]}
I am attempting to do this by using this:
plot(T{:,1},T{:,2:4})
It gives me this error:
Error using plot
Invalid data argument.
What's wrong with it and how can I fix it?

Best Answer

T = table({'2020-01-01';'2020-01-02';'2020-01-03'},[17;15;20],[18;13;15],[12;16;16],'VariableNames',{'Date','Country A','Country B','Country C'})
TT = table2cell(T)
T1 = datetime(TT(:,1))
plot(T1,cell2mat(TT(:,2:4)))
ax = gca; set(ax,'XTickLabels',{'1 Jan 2020', '','3 Jan 2020','', '5 Jan 2020'})