MATLAB: How to calculate the corrlation between columns of different timetables

columnscorrcoefcorrelationcorrelation coefficientMATLABstats::correlationtimetable

I'm looking at half hourly data over a year (e.g. 17568×6 for weather variables, and 17568×1 for various load and demand data timetables). I want to calculate the correlation between individual columns in my weather timetable to (generally the 1st) columns of my load/demand timetable. I've tried
stats::correlation(timetable_weather,1,timetable_demand,1),
which comes up with
Error: File: CorrelationDemandandTemp.m Line: 1 Column: 7 Unexpected MATLAB operator.
And I've read through corrcoef but am not entirely sure how to adapt that to columns of different timetables (I could put the columns I'm wanting to find correlations from in the same timetable if that would help?)

Best Answer

Any "function name" that includes colons inside the name like stats::correlation are functions intended to be called from a MuPAD notebook or via symengine. They cannot be called directly from the MATLAB prompt or in a MATLAB program file (without using symengine.)
Working with variables in a timetable is easy. Using the example timetable from the documentation:
Time = datetime({'2015-12-18 08:03:05';'2015-12-18 10:03:17';'2015-12-18 12:03:13'});
Temp = [37.3;39.1;42.3];
Pressure = [30.1;30.03;29.9];
WindSpeed = [13.4;6.5;7.3];
WindDirection = categorical({'NW';'N';'NW'});
TT = timetable(Time,Temp,Pressure,WindSpeed,WindDirection)
Here's how you would determine the correlation coefficient between Temp, Pressure, and WindSpeed with corrcoef:
C1 = corrcoef(TT.Temp, TT.Pressure)
C2 = corrcoef([TT.Temp, TT.Pressure, TT.WindSpeed])
If TT did not have a categorical variable, you could concatenate all its variables together and then computing C2 would be easier.
TT2 = TT;
TT2.WindDirection = []
C2a = corrcoef(TT2.Variables)