so the question i have is:
Write a single function that takes in a square integer matrix A and the scalars N and G, as well as a 2-value vector R indicating the inclusive range [R(1), R(2)] as inputs.
Has to return:
(1):average of the elements in the nth column
(2):value of the most occuring element
(3):the number of elements within a specified range R, inclusive of the edge values
(4):a Mx2 matrix, with each row containing two elements to represent the indicial position (i.e. row number, column number) of each appearance of the number G.

So far what i have:
(1)
Code:
if (N > size(A,2))
    fprintf('N is out of range of columns');
    
else
    for i = A(:, N)
        A2 = A2 + i;
    end
    
end
fprintf('A1 is %d, A2 is %d', A1, (A2/i));
and the rest im still doing them, dont think i can do 3 and 4 but 2 should be no problem... any pointers/tips would be great! thanks