Skip to content

splitapply

datafun · scripts/datafun/splitapply.m

: Y = splitapply (func, X, G)
: Y = splitapply (func, X1, …, XN, G)
: Y = splitapply (func, T, G)
: [Y1, …, YM] = splitapply (…)

Split data into groups and apply a function (MATLAB R2026a compat, nexus#1742).

G is a vector of positive integers (from findgroups). NaN entries in G omit the corresponding data rows/columns. For N groups, every integer from 1 to N must appear at least once.

When T is a table or timetable, each variable is passed as a separate input to func.