function res = squarerootV4( mat ) %! Works on matrices
[nrows, ncols] = size(mat);
res = zeros(nrows, ncols);
for j=1:nrows % loop over rows %! Outer loop start
   for k=1:ncols % loop over columns %! Inner loop start
      res(j,k) = squarerootV2( mat(j,k) ); %! Scalar calculation
   end %! Inner loop end
end %! Outer loop end
