I need matlab expert

Job ID: 31630429

Budget: $10 – $30 USD

I have a code in matlab but I want to edit it, my code give me n rows and m columns and m×n numbers.
The numbers are linked together with this lines will be sum and must be a new summation which mean no repeated sum for all numbers.
The number whose sum is like a photo down and the second photo give an example when n=3 &m=4.
What I want is to make the code run for all n and I want m =3 at all time.