Write a function matavem that will receive a variablesized m
     Write a function (matave.m) that will receive a variable-sized matrix as an input argument, and calculate and return the overall average of all numbers in the matrix. Use loops, not built-in functions, to calculate the average. 
  
  Solution
function matave
 C=input(\'How many columns are there in P? \');
 R=input(\'How many rows are there in P? \');
 P=zeros(R:C);
 co=1;
 ro=1;
 sum=0;
 a=1;
 while a<=R+C;
 P(a)=input(\'Enter value \');
 sum=sum+a;
 a=a+1;
 end
 sum/(R+C)
 P

