function [specialmax] = specialmax(x)
[r c]=size(x)
t=x(1,:);
for i=2:r
for j=1:c
specialmax=x(1,j);
...
Need to set the initial condition outside the loop; you're overwriting specialmax each time with the first row value as it is.
function [specialmax] = specialmax(x)
[r c]=size(x);
specialmax=(1,:); % initialize to first row
for i=2:r
for j=1:c
...now updated if needs be, but do it in the output array...
Good try...just a tiny logic boo-boo :)