Function makematrix in functionality Complete.