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: plePlotMultiLLH.m
    path of file: ./repos/d2d/arFramework3/PLE
    
    the code of the file until where you have to start completion: % Plot compact profile Likelihoods
%
% plePlotMulti
    
function plePlotMultiLLH(ncols, nrows, savetofile)

global ar

if(isempty(ar.ple))
    error('perform ple before usage');
end
if(isempty(ar.ple.ps))
    return
end
if(~exist('savetofile','var'))
    savetofile = false;
end

sumples = 0;
length(ar.ple.ps)
for j=1:length(ar.ple.ps)
    if(~isempty(ar.ple.ps{j}))
        sumples = sumples + 1;
    end
end

if(~exist('ncols', 'var'))
    ncols = ceil(sumples^(0.4))+1;
    nrows = ceil(sumples/ncols);
end