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: getDataFromSPM.m
    path of file: ./repos/bspm/thirdparty/rsatoolbox/Engines
    
    the code of the file until where you have to start completion: function betas = getDataFromSPM(userOptions)
%
% getDataFromSPM is a function which will extract from the SPM metadata the
% correspondence between the beta image filenames and the condition and session
% number.
%
% function betas = getDataFromSPM(userOptions)
%
%        betas --- The array of info.
%               betas(condition, session).identifier is a string which referrs
%               to the filename (not including path) of the SPM beta image.
%
%        userOptions --- The options struct.
%                userOptions.subjectNames
%                        A cell array containing strings identifying the subject
%                        names.
%                userOptions.betaPath
%                        A string which contains the absolute path to the
%                        location of the beta images. It can contain the
%                        following wildcards which would be replaced as
%                        indicated:

    
function betas = getDataFromSPM(userOptions)
%
% getDataFromSPM is a function which will extract from the SPM metadata the
% correspondence between the beta image filenames and the condition and session
% number.
%
% function betas = getDataFromSPM(userOptions)
%
%        betas --- The array of info.
%               betas(condition, session).identifier is a string which referrs
%               to the filename (not including path) of the SPM beta image.
%
%        userOptions --- The options struct.
%                userOptions.subjectNames
%                        A cell array containing strings identifying the subject
%                        names.
%                userOptions.betaPath
%                        A string which contains the absolute path to the
%                        location of the beta images. It can contain the
%                        following wildcards which would be replaced as
%                        indicated:
%                                [[subjectName]]
%                                        To be replaced with the contents of
%                                        subject.
%                                [[betaIdentifier]]
%                                        To be replaced by filenames returned in
%                                        betas.
%                userOptions.conditionLabels
%                        A cell array containing the names of the conditions in
%                        this experiment. Here, these will be used to find
%                        condition response beta predictor images (so make sure
%                        they're the same as the ones used for SPM!).
%  
%  Cai Wingfield 12-2009, 6-2010, 8-2010
	%% Set defaults and check for problems.
	if ~isfield(userOptions, 'betaPath'), error('getDataFromSPM:NoBetaPath', 'userOptions.betaPath is not set. See help.'); end