Let v be the 3x3 diagonal matrix with all zero entries except for a 1 in row 1 column 1.
Let w be the 3x3 diagonal matrix with all zero entries except for a 1 in row 2 column 2.
Let z be the 3x3 diagonal matrix with all zero entries except for a 1 in row 3 column 3.
S = {v, w, z) is a basis of the 3 dimensional vector space of 3x3 diagonal matrices since S is a set of 3 linearly independent vectors in the vector space that spans the vector space.