Matlab's example below usses splitapply on a function which has two input arguments (h,w) but is called in splitapply with a signle input table (DT). How does Matlab chose which variable in the DT table is h and which is w?
https://www.mathworks.com/help/matlab/ref/splitapply.html
load patientsDT = table(Height,Weight);GT = table(Gender,Smoker);Define a function that calculates mean BMI from the weights and heights of groups or patients.meanBMIFcn = @(h,w)mean((w ./ (h.^2)) * 703);Create a table that contains the mean BMI for each group.[G,results] = findgroups(GT);meanBMI = splitapply(meanBMIFcn,DT,G);
Best Answer