You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: median.m
    path of file: ./repos/matStats/matStats/@Table
    
    the code of the file until where you have to start completion: function res = median(obj, varargin)
% Put the median of each column in a new table.
%
%   RES = median(TAB)
%   Computes the median of each column in the table, and put the result in
%   a new table.
%
%   RES = median(TAB, DIM)
%   Specifies the dimension for computing sum. Default is 1.
%

    
function res = median(obj, varargin)
% Put the median of each column in a new table.
%
%   RES = median(TAB)
%   Computes the median of each column in the table, and put the result in
%   a new table.
%
%   RES = median(TAB, DIM)
%   Specifies the dimension for computing sum. Default is 1.
%
%   Example
%     iris = Table.read('fisherIris.txt');
%     median(iris(:,1:4))
%     ans =
%                   SepalLength    SepalWidth    PetalLength    PetalWidth
%         median            5.8             3           4.35           1.3
%
%   See also
%     mean, std, sum
%

% ------
% Author: David Legland
% e-mail: david.legland@inra.fr
% Created: 2011-06-17,    using Matlab 7.9.0.529 (R2009b)
% Copyright 2011 INRA - Cepia Software Platform.


% check conditions
if hasFactors(obj)
    error('Can not compute median for table with factors');
end