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: scnlab_norm_check3.m
    path of file: ./repos/CanlabCore/CanlabCore/diagnostics
    
    the code of the file until where you have to start completion: function EXPT = scnlab_norm_check3(wt1,subjlabels,template,mask,varargin)
% WARNIN
    
function local_plot_results(EXPT, template, wt1, subjlabels)


    % plot results
    % ____________________________________________________________

    tmp = scale(EXPT.SUBJECT.norm_vs_template); tmp2 = tmp;

    % save best two and worst two overall
    overall = tmp;
    overall(:,2:3) = -1*overall(:,2:3);
    overall = mean(overall,2);   % higher is worse
    EXPT.SUBJECT.overall_t1 = overall;
    overall2 = overall;
    tmp = find(overall == min(overall)); wh(1) = tmp; overall(tmp) = NaN;
    tmp = find(overall == min(overall)); wh(2) = tmp; overall(tmp) = NaN;
    tmp = find(overall == max(overall)); wh(3) = tmp; overall(tmp) = NaN;
    tmp = find(overall == max(overall)); wh(4) = tmp; overall(tmp) = NaN;
    P = str2mat(template,wt1(wh,:));
    EXPT.SUBJECT.best_t1 = P(1:2,:);
    EXPT.SUBJECT.worst_t1 = P(3:4,:);

    spm_check_registration(P);

    % relies on the figure created by compare_subjects... too closely coupled
    h = sort(get(gcf,'Children'));
    axes(h(3)); title('Canonical template');
    axes(h(7)); title(['Best: ' subjlabels{wh(1)}]);
    axes(h(11)); title(['Best: ' subjlabels{wh(2)}]);
    axes(h(15)); title(['Worst: ' subjlabels{wh(3)}]);
    axes(h(19)); title(['Worst: ' subjlabels{wh(4)}]);

    h2 = axes('Position',[.6 .05 .3 .25]);
    plot(tmp2,1:length(tmp2)); %try legend