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: spm_eeg_inv_results_display.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function spm_eeg_inv_results_display(D)
% Displays contrast of evoked responses and power
% FORMAT spm_eeg_inv_results_display((D)
%__________________________________________________________________________
% Copyright (C) 2007-2013 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_eeg_inv_results_display.m 5367 2013-03-28 13:03:39Z guillaume $

%==========================================================================
Ndip  = 256; % Number of dipoles to display
%==========================================================================

%-MEEG data structure
%==========================================================================
try, val = D.val; catch, val = 1; end
try, con = D.con; catch, con = 1; end

if con == 0
    con = 1;
end

model = D.inv{D.val};
try
    con = min(con,length(model.contrast.GW));

    
function spm_eeg_inv_results_display(D)
% Displays contrast of evoked responses and power
% FORMAT spm_eeg_inv_results_display((D)
%__________________________________________________________________________
% Copyright (C) 2007-2013 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_eeg_inv_results_display.m 5367 2013-03-28 13:03:39Z guillaume $

%==========================================================================
Ndip  = 256; % Number of dipoles to display
%==========================================================================

%-MEEG data structure
%==========================================================================
try, val = D.val; catch, val = 1; end
try, con = D.con; catch, con = 1; end

if con == 0
    con = 1;
end

model = D.inv{D.val};
try
    con = min(con,length(model.contrast.GW));
catch
    warndlg('please specify a [time-frequency] contrast')
    return
end