now uses function where data is stacked as input list (default matmean)