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/spm
    
    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)
%__________________________________________________________________________

% Karl Friston
% Copyright (C) 2007-2022 Wellcome Centre for Human Neuroimaging

    
function spm_eeg_inv_results_display(D)
% Displays contrast of evoked responses and power
% FORMAT spm_eeg_inv_results_display(D)
%__________________________________________________________________________

% Karl Friston
% Copyright (C) 2007-2022 Wellcome Centre for Human Neuroimaging


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