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: CoreModelPlots.m
    path of file: ./repos/d2d/arFramework3/Examples/Sobotta_Frontiers2017/PlotFunctions
    
    the code of the file until where you have to start completion: function CoreModelPlots( png, printFigs )
   
    PlotSettings;
    close all;
    global ar;
    
    % Plot colors
    WT_color        = [0 127 255]./255;
    rux_color       = [255 0 255]./255;
    sta_color       = [175 36 126]./255;
    control_color   = [0 0 0]./255;

    % Output directory
    directory = 'Core';
    mkdir figures;

    % Output format
    if ~exist( 'png', 'var' )
        png = 0;
    end
    
    % Export figures?
    if ~exist( 'printFigs', 'var' )
        printFigs = 0;
    end    

	 % Set up export function
    if ( printFigs )
        switch( png )
            case 0
                % eps
                mkdir( sprintf( 'figures/%s', directory ) );
                printfig = @(filename)print('-depsc2', '-loose', '-cmyk', '-r300', '-painters', sprintf('figures/%s/%s.eps', directory, filename) );
            case 1
                %png
                directory = [directory '_png'];
                mkdir( sprintf( 'figures/%s', directory ) );
                printfig = @(filename)print('-dpng', '-loose', '-cmyk', '-r300', '-painters', sprintf('figures/%s/%s.png', directory, filename) );
            case 2
                mkdir( sprintf( 'figures/%s', directory ) );
                printfig = @(filename)printTikz(sprintf('figures/%s/%s.pdf', directory, filename));
        end
    else
        printfig = @(filename)disp('No file export!'); %#ok
    end

    % Core model figures pt. 1
    clear a;
    figure('units','normalized','outerposition',[0 0 1 1]);
    a = axes; qPlotTC( ar, arFindData( '2005_02_03'), WT_color, 'pJAK1_wb' );
    qLabels( 'phospho-JAK1', '', '', [0 20 40 60 80 100], [-1 -0.5 0], 1, 2 );
    qLegend( a, {'Untreated', 'IL6 (40 ng/mL)'} );
    axes; qPlotTC( ar, arFindData( '2005_02_03'), WT_color, 'pgp130_wb' );
    qLabels( 'phospho-gp130', '', '', [0 20 40 60 80 100], [-1 -0.5 0], 2, 2 );
    axes; qPlotTC( ar, arFindData( '2005_02_03'), WT_color, 'pSTAT3_wb' );
    qLabels( 'phospho-STAT3', '', '', [0 20 40 60 80 100], [-0.8, -0.6, -0.4, -0.2, 0 0.2], 1, 1 );
    axes; a(1) = qPlotTC( ar, arFindData( '2013_07_08', 'input_il6', 0), control_color, 'SOCS3_qpcr' );
    a(2) = qPlotTC( ar, arFindData( '2013_07_08', 'input_il6', 40), WT_color, 'SOCS3_qpcr' );
    qLabels( 'Socs3 mRNA', '', '', [0 20 40 60 80 100 120], [-2 -1.5 -1 -0.5 0], 2, 1 );
    pyData = arFindData( '2011_04_04');
    axes; b(1)=qPlotTC( ar, pyData(1), control_color, 'pSTAT3_ms' );
    hold on; b(2)=qPlotTC( ar, pyData(2), WT_color, 'pSTAT3_ms' );
    qLabels( 'phospho-STAT3 (Tyr-705)', 'Time (min)', 'Degree of phosphorylation (%)', [0 10 20], [0, 20, 40, 60], 3, 2 );
    axes; qPlotTC( ar, arFindData( 'xiaoyun_nucSTAT3_Ratio' ), WT_color, 'ntSTAT3_ratio' );
    qLabels( 'mKate2-STAT3', 'Time (min)', 'Nuc/cyt ratio', [-10 0 10 20 30], [0.3 1 3.2 10], 3, 1, [0,1] );
    printfig( 'Core Model A' );

    % Core model figures pt 2

    
function CoreModelPlots( png, printFigs )
   
    PlotSettings;
    close all;
    global ar;
    
    % Plot colors
    WT_color        = [0 127 255]./255;
    rux_color       = [255 0 255]./255;
    sta_color       = [175 36 126]./255;
    control_color   = [0 0 0]./255;

    % Output directory
    directory = 'Core';
    mkdir figures;

    % Output format
    if ~exist( 'png', 'var' )
        png = 0;
    end
    
    % Export figures?
    if ~exist( 'printFigs', 'var' )
        printFigs = 0;
    end    

	 % Set up export function
    if ( printFigs )
        switch( png )
            case 0
                % eps
                mkdir( sprintf( 'figures/%s', directory ) );
                printfig = @(filename)print('-depsc2', '-loose', '-cmyk', '-r300', '-painters', sprintf('figures/%s/%s.eps', directory, filename) );
            case 1
                %png
                directory = [directory '_png'];
                mkdir( sprintf( 'figures/%s', directory ) );
                printfig = @(filename)print('-dpng', '-loose', '-cmyk', '-r300', '-painters', sprintf('figures/%s/%s.png', directory, filename) );
            case 2
                mkdir( sprintf( 'figures/%s', directory ) );
                printfig = @(filename)printTikz(sprintf('figures/%s/%s.pdf', directory, filename));
        end
    else
        printfig = @(filename)disp('No file export!'); %#ok
    end

    % Core model figures pt. 1
    clear a;
    figure('units','normalized','outerposition',[0 0 1 1]);
    a = axes; qPlotTC( ar, arFindData( '2005_02_03'), WT_color, 'pJAK1_wb' );
    qLabels( 'phospho-JAK1', '', '', [0 20 40 60 80 100], [-1 -0.5 0], 1, 2 );
    qLegend( a, {'Untreated', 'IL6 (40 ng/mL)'} );
    axes; qPlotTC( ar, arFindData( '2005_02_03'), WT_color, 'pgp130_wb' );
    qLabels( 'phospho-gp130', '', '', [0 20 40 60 80 100], [-1 -0.5 0], 2, 2 );
    axes; qPlotTC( ar, arFindData( '2005_02_03'), WT_color, 'pSTAT3_wb' );
    qLabels( 'phospho-STAT3', '', '', [0 20 40 60 80 100], [-0.8, -0.6, -0.4, -0.2, 0 0.2], 1, 1 );
    axes; a(1) = qPlotTC( ar, arFindData( '2013_07_08', 'input_il6', 0), control_color, 'SOCS3_qpcr' );
    a(2) = qPlotTC( ar, arFindData( '2013_07_08', 'input_il6', 40), WT_color, 'SOCS3_qpcr' );
    qLabels( 'Socs3 mRNA', '', '', [0 20 40 60 80 100 120], [-2 -1.5 -1 -0.5 0], 2, 1 );
    pyData = arFindData( '2011_04_04');
    axes; b(1)=qPlotTC( ar, pyData(1), control_color, 'pSTAT3_ms' );
    hold on; b(2)=qPlotTC( ar, pyData(2), WT_color, 'pSTAT3_ms' );
    qLabels( 'phospho-STAT3 (Tyr-705)', 'Time (min)', 'Degree of phosphorylation (%)', [0 10 20], [0, 20, 40, 60], 3, 2 );
    axes; qPlotTC( ar, arFindData( 'xiaoyun_nucSTAT3_Ratio' ), WT_color, 'ntSTAT3_ratio' );
    qLabels( 'mKate2-STAT3', 'Time (min)', 'Nuc/cyt ratio', [-10 0 10 20 30], [0.3 1 3.2 10], 3, 1, [0,1] );
    printfig( 'Core Model A' );

    % Core model figures pt 2
    clear a;
    figure('units','normalized','outerposition',[0 0 1 1]);
    axes; qPlotDR( ar, arFindData( '2011_12_12'), 'input_stattic', 20, WT_color, 'pSTAT3_wb', -1 ); hold on;
    qPlotDR( ar, arFindData( '2011_12_12'), 'input_stattic', 0, control_color, 'pSTAT3_wb', -1 ); ylim([-2.25 .75]);
    qLabels( 'phospho-STAT3', 'Stattic (\mu M)', 'Concentration (log_{10} a.u.)', [0, 1, 5, 10, 20, 50], [-2. -1. 0], 1, 2, [1, 0] );
    axes; a(2) = qPlotDR( ar, arFindData( '2013_06_03', 'input_il6', 40), 'input_ruxolitinib', [], WT_color, 'pSTAT3_wb', 0 ); hold on;
    a(1) = qPlotDR( ar, arFindData( '2013_06_03', 'input_il6', 0), 'input_ruxolitinib', [], control_color, 'pSTAT3_wb', 0 ); ylim([-4 1]);
    qLabels( 'phospho-STAT3', 'Ruxolitinib (\mu M)', 'Concentration (log_{10} a.u.)', [0, 10, 100, 1000, 10000], [-4, -2, 0], 1, 1, [1, 0] );
    xo = get(gca,'XLim'); xlim([xo(1), 4.1]);
    qLegend