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: f_preparms_erpwaviewer.m
    path of file: ./repos/erplab/studio_functions/Functions/EStudio/ERP Tab/ERP wave viewer
    
    the code of the file until where you have to start completion: 
% *** This function is part of EStudio Toolbox ***
% Author: Guanghui Zhang & Steven Luck
% Center for Mind and Brain
% University of California, Davis,
% Davis, CA
% 2022




function OutputViewerpar = f_preparms_erpwaviewer(FigureName,History)
OutputViewerpar = '';
if nargin<1
    help f_preparms_erpwaviewer();
    return
end

if nargin<2
    History = 'gui';
end
try
    ALLERPwaviewerin = evalin('base','ALLERPwaviewer');
    ERPwaviewerIN = ALLERPwaviewerin;
catch
    beep;
    disp('f_preparms_erpwaviewer() error: There is no "ALLERPwaviewer" on Workspace, please run 
    
function
if ~isempty(FigureName)
    [ALLERP, erpcom] = pop_plotERPwaviewer(ALLERPIN,PagesIndex,ERPsetArray, binArray, chanArray,...
        'PLOTORG',PLOTORG,'GridposArray',GridposArray,'LabelsName',plotArrayStr, 'Blc', Blc,'Box',plotBox,'LineColor',LineColorspec,'LineStyle',LineStylespec,...
        'LineMarker',LineMarkerspec,'LineWidth',LineWidthspec,'LegendName',LegendName,'LegendFont',FontLeg,'LegendFontsize',FontSizeLeg,...
        'Labeloc',CBELabels,'Labelfont',CBEFont,'Labelfontsize',CBEFontsize,'YDir',PolarityWave,'SEM',Standerr,'Transparency', Transparency,...
        'GridSpace',Gridspace,'TimeRange',timeRange,'Xticks',timeticks,'Xticklabel',xticklabel,'Xlabelfont',xlabelFont,'Xlabelfontsize',xlabelFontsize,...
        'Xlabelcolor',xlabelFontcolor,'Xunits',Xunits,'MinorTicksX',MinorticksX,...
        'YScales',Yscales,'Yticks',Yticks,'Yticklabel',yticklabel,'Ylabelfont',YlabelFont,'Ylabelfontsize',YlabelFontsize,...
        'Ylabelcolor',ylabelFontcolor,'Yunits',yunits,'MinorTicksY',MinorticksY,'LegtextColor',TextcolorLeg,'Legcolumns',Legcolumns,...
        'FigureName',FigureName,'FigbgColor',figbgdColor,'Labelcolor',CBETcolor,'Ytickdecimal',Ytickprecision,'Xtickdecimal',Xtickprecision,'XtickdisFlag',XdispFlag,...
        'FigOutpos',FigOutpos,'History', History);%
else
    OutputViewerpar{1} =  ALLERPIN;
    OutputViewerpar{2} =  PagesIndex;
    OutputViewerpar{3} =  PLOTORG;
    OutputViewerpar{4} =  binArray;
    OutputViewerpar{5} =  chanArray;
    OutputViewerpar{6} =  GridposArray;
    OutputViewerpar{7} =  plotArrayStr;
    OutputViewerpar{8} =  Blc;
    OutputViewerpar{9} =  plotBox;
    OutputViewerpar{10} =  LineColorspec;
    OutputViewerpar{11} =  LineStylespec;
    OutputViewerpar{12} =  LineMarkerspec;
    OutputViewerpar{13} =  LineWidthspec;
    OutputViewerpar{14} =  Legend