multi.mat function

MAT for multiple variables