A method for constructing sets of matrices that pairwise commute is presented. The sets are defined such that each matrix is a combination of basic matrices. An iterative algorithm is given, where the construction approach aims to obtain appropriate basic matrices. A numerical example illustrate the proposed method.