def load_matlab_model(infile_path, variable_name=None, inf=inf):
if not scipy_io:<EOL><INDENT>raise ImportError('<STR_LIT>')<EOL><DEDENT>data = scipy_io.loadmat(infile_path)<EOL>possible_names = []<EOL>if variable_name is None:<EOL><INDENT>meta_vars = {"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"}<EOL>possible_names = sorted(i for i in data if i not in meta_vars)<EOL>if len(possible_names) == <NUM_LIT:1>:<EOL><INDENT>variable_name = possible_names[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>if variable_name is not None:<EOL><INDENT>return from_mat_struct(data[variable_name], model_id=variable_name,<EOL>inf=inf)<EOL><DEDENT>for possible_name in possible_names:<EOL><INDENT>try:<EOL><INDENT>return from_mat_struct(data[possible_name], model_id=possible_name,<EOL>inf=inf)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>raise IOError("<STR_LIT>")<EOL>
Load a cobra model stored as a .mat file

    Parameters
    ----------
    infile_path: str
        path to the file to to read
    variable_name: str, optional
        The variable name of the model in the .mat file. If this is not
        specified, then the first MATLAB variable which looks like a COBRA
        model will be used
    inf: value
        The value to use for infinite bounds. Some solvers do not handle
        infinite values so for using those, set this to a high numeric value.

    Returns
    -------
    cobra.core.Model.Model:
        The resulting cobra model