generate label matrix