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: construct_model_tmpwork.m
    path of file: ./repos/CanlabCore/CanlabCore/OptimizeDesign11/GA2
    
    the code of the file until where you have to start completion: function [X,paramvec,conditions] = construct_model(mspec,conditions,paramvec,varargin)
%[X,paramvec] = construct_model(mspec,conditions,paramvec)
%
% paramvec is a matrix that completely specifies the choices of random variables
% to re-create a design, use the original conditions and paramvec
%
% if you specify variable trial onsets in condition(i).onsets, then any subsequent
% sub-trial parts you specify as fixed onset may be randomly chosen within the range
% of the first two s
    
function [x,paramvec,paramindex,ons] = cond2reg(c,mspec,paramvec,paramindex,varargin)
% given a condition structure, returns regressor
%
% x is reg or set of regs to add to model
% paramvec is cell array of onsets (relative to...) for design reconstruction
% paramindex is index of which cell in paramvec to use for reconstruction of which condition
% ons is vector of trial onsets, for updating conditions, if necessary
%
% varargin is list of all trials, to constrain to no overlap

    if isfield(c,'parts')
        if c.parts ~= 1
            % can't build regressor from trial type with parts - return
            x = [];
           return
       end