% compile the mex file mex mexme.cpp input = [ 1 2 3 10; ... 4 5 6 12; ... 7 8 9 11]; % run the mex file [output1, output2] = mexme(input); output1 output2 % after reading 'mexme.cpp' try changing it, % so that it returns one more matrix of size 1x1, % which contains the average of the values of % the input matrix