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: commandlinehelper.m
    path of file: ./repos/segment-open/source
    
    the code of the file until where you have to start completion: function [varargout] = commandlinehelper(arg,varargin)
%Helper function to handle commandline options

%Einar Heiberg

persistent s %store options in persistent variable

%--- Define commandline options
c = [];
c(1).switch = 'StudiesFolder'; c(1).nargin = 1; c(1).default = ''; c(1).description = '<dir>: folder software reads input files (dicoms), each subfolder is one series';
c(2).switch = 'DICOMStorageFolder'; c(2).nargin = 1; c(2).default = ''; c(2).description = '<dir>: folder where output dicom files are stored';
c(3).switch = 'LogFolder'; c(3).nargin = 1; c(3).default = ''; c(3).description = '<dir>: folder where log-files are stored';
c(4).switch = 'NoQuit'; c(4).nargin = 0; c(4).default = false; c(4).description = ': Disable quit options';
c(5).switch = 'NoPopUp'; c(5).nargin = 0; c(5).default = false; c(5).description = ': Disable pop-up when starting';
c(6).switch = 'License'; c(6).nargin = 1; c(6).default = ''; c(6).description = '<file>: License file';
c(7).switch = 'TempStorageFolder'; c(7).nargin = 1; c(7).default = ''; c(7).description = '<dir>: folder for temporal file storage';
c(8).switch = 'UseDefaultStudiesFolder'; c(8).nargin = 0; c(8).default = false; c(8).description = '<dir>: Create studies folder if it not existing according to default preference settings';
c(9).switch = 'UseComputerAETitle'; c(9).nargin = 0; c(9).default = false; c(9).description = '<dir>: Use computer AETitle in case if in segpref was different one assigned';
switch arg
  case 'parse'
    %do nothing here, do later after switch clause
  case 'getparameters'
    %return parameters
    varargout = cell(1,1);
    varargout{1} = s;
    return
  case 'storetopref'
    %store settings to prefstruct
    storetopref(s);

    
function [varargout] = commandlinehelper(arg,varargin)
%Helper function to handle commandline options

%Einar Heiberg

persistent s %store options in persistent variable

%--- Define commandline options
c = [];
c(1).switch = 'StudiesFolder'; c(1).nargin = 1; c(1).default = ''; c(1).description = '<dir>: folder software reads input files (dicoms), each subfolder is one series';
c(2).switch = 'DICOMStorageFolder'; c(2).nargin = 1; c(2).default = ''; c(2).description = '<dir>: folder where output dicom files are stored';
c(3).switch = 'LogFolder'; c(3).nargin = 1; c(3).default = ''; c(3).description = '<dir>: folder where log-files are stored';
c(4).switch = 'NoQuit'; c(4).nargin = 0; c(4).default = false; c(4).description = ': Disable quit options';
c(5).switch = 'NoPopUp'; c(5).nargin = 0; c(5).default = false; c(5).description = ': Disable pop-up when starting';
c(6).switch = 'License'; c(6).nargin = 1; c(6).default = ''; c(6).description = '<file>: License file';
c(7).switch = 'TempStorageFolder'; c(7).nargin = 1; c(7).default = ''; c(7).description = '<dir>: folder for temporal file storage';
c(8).switch = 'UseDefaultStudiesFolder'; c(8).nargin = 0; c(8).default = false; c(8).description = '<dir>: Create studies folder if it not existing according to default preference settings';
c(9).switch = 'UseComputerAETitle'; c(9).nargin = 0; c(9).default = false; c(9).description = '<dir>: Use computer AETitle in case if in segpref was different one assigned';
switch arg
  case 'parse'
    %do nothing here, do later after switch clause
  case 'getparameters'
    %return parameters
    varargout = cell(1,1);
    varargout{1} = s;
    return
  case 'storetopref'
    %store settings to prefstruct
    storetopref(s);
    return;
  case 'reset'
    %reset persistent variable
    s = [];
    for loop = 1:length(c)
      s.(c(loop).switch) = c(loop).default;
    end