def load_bbci_sets_from_folder(
    folder: str, runs: list[int] | str = "all"
) -> list[mne.io.RawArray]:
    """
    Load bbci datasets from files in given folder.

    Parameters
    ----------
    folder: str
        Folder with .BBCI.mat files inside
    runs: list of int
        If you only want to load specific runs.
        Assumes filenames with such kind of part: S001R02 for Run 2.
        Tries to match this regex: ``'S[0-9]{3,3}R[0-9]{2,2}_'``.

    Returns
    -------

    """
    bbci_mat_files = sorted(glob(os.path.join(folder, "*.BBCI.mat")))
    if runs != "all":
        assert isinstance(runs, list), "runs should be list[int] or 'all'"
        matches = [re.search("S[0-9]{3,3}R[0-9]{2,2}_", f) for f in bbci_mat_files]
        file_run_numbers = [int(m.group()[5:7]) for m in matches if m is not None]
        assert len(file_run_numbers) == len(bbci_mat_files), "Some files don't match"
        indices = [file_run_numbers.index(num) for num in runs]

        wanted_files = np.array(bbci_mat_files)[indices]
    else:
        wanted_files = bbci_mat_files
    cnts = []
    for f in wanted_files:
        log.info("Loading {:s}".format(f))
        cnts.append(BBCIDataset(f).load())
    return cnts

    Load bbci datasets from files in given folder.

    Parameters
    ----------
    folder: str
        Folder with .BBCI.mat files inside
    runs: list of int
        If you only want to load specific runs.
        Assumes filenames with such kind of part: S001R02 for Run 2.
        Tries to match this regex: ``'S[0-9]{3,3}R[0-9]{2,2}_'``.

    Returns
    -------

    
braindecode/datasets/bbci.py