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: constructRDMs.m
    path of file: ./repos/bspm/thirdparty/rsatoolbox/Modules
    
    the code of the file until where you have to start completion: function [varargout] = constructRDMs(responsePatterns, betaCorrespondence, userOptions)
%
% [RDMs =] constructRDMs(responsePatterns, betaCorrespondence, userOptions)
%
% constructRDMs is a function which takes a matrix of imaging data and
% computes RDMs from it, one RDM for each ROI, subject, and scanning
% session. The RDMs are returned in a structure
% with names reflecting the ROI, subject and session. The returned RDMs are
% also saved. The RDM structure format ensures that the RDMs will be
% properly labeled in subsequent analyses.
%
% responsePatterns: The input response patterns. It contains the masked
% brain activity maps in a structure such that
% responsePatterns.(mask).(subject) is a [nMaskedVoxels nConditions
% nSessions] matrix, where mask is a binary brain map that defines the ROI.
% 
% betaCorrespondence: The array of beta filenames.
% betas(condition, session).identifier is a string which refers to the
% filename (not including the path) of the SPM beta image. Alternatively,
% this can be the string "SPM", in which case the SPM metadata will be used
% to infer this information, provided that userOptions.conditionLabels is
% set, and the condition labels are the same as those used in SPM. It must

    
function [varargout] = constructRDMs(responsePatterns, betaCorrespondence, userOptions)
%
% [RDMs =] constructRDMs(responsePatterns, betaCorrespondence, userOptions)
%
% constructRDMs is a function which takes a matrix of imaging data and
% computes RDMs from it, one RDM for each ROI, subject, and scanning
% session. The RDMs are returned in a structure
% with names reflecting the ROI, subject and session. The returned RDMs are
% also saved. The RDM structure format ensures that the RDMs will be
% properly labeled in subsequent analyses.
%
% responsePatterns: The input response patterns. It contains the masked
% brain activity maps in a structure such that
% responsePatterns.(mask).(subject) is a [nMaskedVoxels nConditions
% nSessions] matrix, where mask is a binary brain map that defines the ROI.
% 
% betaCorrespondence: The array of beta filenames.
% betas(condition, session).identifier is a string which refers to the
% filename (not including the path) of the SPM beta image. Alternatively,
% this can be the string "SPM", in which case the SPM metadata will be used
% to infer this information, provided that userOptions.conditionLabels is
% set, and the condition labels are the same as those used in SPM. It must
% be noted that this module assumes that data is in such a format that the
% input structure has one field per subject, session and mask. Defining
% betaCorrespondence or choosing ‘SPM’ does not automatically compute the
% responsePatterns structure. At this point only the number of sessions
% and/or conditions are extracted from SPM or betaCorrespondence.
% 
% userOptions: The standard options structure containing the following
% fields:
% userOptions.analysisName: A string which is prepend