@docfiller<EOL>def mat_reader_factory(file_name, appendmat=True, **kwargs):
byte_stream = _open_file(file_name, appendmat)<EOL>mjv, mnv = get_matfile_version(byte_stream)<EOL>if mjv == <NUM_LIT:0>:<EOL><INDENT>return MatFile4Reader(byte_stream, **kwargs)<EOL><DEDENT>elif mjv == <NUM_LIT:1>:<EOL><INDENT>return MatFile5Reader(byte_stream, **kwargs)<EOL><DEDENT>elif mjv == <NUM_LIT:2>:<EOL><INDENT>raise NotImplementedError('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>' % mjv)<EOL><DEDENT>
Create reader for matlab .mat format files

    Parameters
    ----------
    %(file_arg)s
    %(append_arg)s
    %(load_args)s
    %(struct_arg)s

    Returns
    -------
    matreader : MatFileReader object
       Initialized instance of MatFileReader class matching the mat file
       type detected in `filename`.