generateLegends.m