% find maps that match a criterion matched = find(~isemptycell(regexpi(vmp.MapNames, 'reappraise'))); nummatched = numel(matched); % compute mean and store as new map vmp.ComputeFormula(sprintf( ... 'mean($1:%d, 4)', nummatched), struct('mapsel', matched));