|
I'm looking to reduce two variables (X, Y) of a grouped dataset object into one variable by a function like corr(X,Y), but I cannot find a good way to enter that as a function handle in grpstats() as they only accept one input.
*********************************************************************
to use grpstats(), u will need a measurement, and say your groups are X, Y.
a = grpstats(meas, group, @(c) corr(c))
where your group will be X, and Y in one length, it could be cell array or logical or nummeric etc. There is an example in the statistics toolbox on grouped data.
btw, what kind of variables are ur X and Y.
*******************************************************************
> Is there a neat way to achieve this without concatenating two variables into one matrix? My dataset is pretty large and dense, so I don't want to unnecessarily double the amount of required memory.
*******************************************************************
a = grpstats(meas, [X;Y], @(c) corr(c)) ------ the variables X, Y , are already in memory, u are not using additional memory
*******************************************************************
|