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: displayInterRes.m
    path of file: ./repos/CS_MoCo_LAB/reconstruction/matlab/CS_LAB_matlab/utils/general
    
    the code of the file until where you have to start completion: function displayInterRes( imgIn )
%DISPLAYINTERRES display intermediate results
%
% (c) Thomas Kuestner
% ---------------------------------------------------------------------

% set all parameters here inside

persistent paraIR;

if(ischar(imgIn))   
    clear paraIR;
    return;
end

if(~isfield(paraIR,'dim'))
    paraIR.dim = ndims(imgIn);
    if(paraIR.dim == 3)
        % y-x-cha
        paraIR.subs = {':',':',':'};
        paraIR.permRule = [];
        
    elseif(paraIR.dim == 4)
        % 3D: y-z-x-cha
        
        paraIR.subs = {':', ':', ceil(size(imgIn,2)/2), ':'};
        paraIR.permRule = [1 3 2 4]; % => y-x-z-cha
        
%         % OR
%         % 2Dt: t-y-x-cha

    
function displayInterRes( imgIn )
%DISPLAYINTERRES display intermediate results
%
% (c) Thomas Kuestner
% ---------------------------------------------------------------------

% set all parameters here inside

persistent paraIR;

if(ischar(imgIn))   
    clear paraIR;
    return;
end

if(~isfield(paraIR,'dim'))
    paraIR.dim = ndims(imgIn);
    if(paraIR.dim == 3)
        % y-x-cha
        paraIR.subs = {':',':',':'};
        paraIR.permRule = [];
        
    elseif(paraIR.dim == 4)
        % 3D: y-z-x-cha
        
        paraIR.subs = {':', ':', ceil(size(imgIn,2)/2), ':'};
        paraIR.permRule = [1 3 2 4]; % => y-x-z-cha
        
%         % OR
%         % 2Dt: t-y-x-cha
%         paraIR.subs = {':', ':', ceil(size(imgIn,1)/2), ':'};
%         paraIR.permRule = [2 3 1 4]; % => y-x-t-cha
        
    elseif(paraIR.dim == 5)
        % t-y-z-x-cha
        paraIR.subs = {':', ':', ceil(size(imgIn,3)/2), ceil(size(imgIn,1)/2), ':'};
        paraIR.permRule = [2 4 3 1 5]; % => y-x-z-t-cha
    end