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: loadvar.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/fieldtrip/private
    
    the code of the file until where you have to start completion: function value = loadvar(filename, varname)

% LOADVAR is a helper function for cfg.inputfile
%
% See also SAVEVAR

% Copyright (C) 2010, Robert Oostenveld
%
% $Id$

assert(ischar(filename), 'file name should be a string');

if nargin<2

    
function value = loadvar(filename, varname)

% LOADVAR is a helper function for cfg.inputfile
%
% See also SAVEVAR

% Copyright (C) 2010, Robert Oostenveld
%
% $Id$

assert(ischar(filename), 'file name should be a string');

if nargin<2
  ft_info('reading variable from file ''%s''\n', filename);
else
  assert(ischar(varname), 'variable name should be a string');
  ft_info('reading ''%s'' from file ''%s''\n', varname, filename);
end