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: mseq.m
    path of file: ./repos/CanlabCore/CanlabCore/OptimizeDesign11/M-sequence/mseq
    
    the code of the file until where you have to start completion: function ms=mseq(baseVal,powerVal,varargin)

    
function ms=mseq(baseVal,powerVal,varargin)
%		  Maximum length sequence assuming 2,3,5 distinct values
%
%       [ms]=MSEQ(powerVal,baseVal[,shift,whichSeq])
%
%       OUTPUT:
%       ms = generated maximum length sequence, of length basisVal^powerVal-1
%
%       INPUT:
%		  baspowerVal=ceil(powerVal);

% Written by Giedrius T. Buracas, SNL-B, Salk Institute
% Register values are taken from: WDT Davies, System Identification
% for self-adaptive control. Wiley-Interscience, 1970

if nargin < 4, whichSeq = [];,else, whichSeq = varargin{2};,end