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: countContiguousOnes.m
    path of file: ./repos/iptutorials/TB_IPR/EXAM.2018/up2_pratique_matlab
    
    the code of the file until where you have to start completion: function n = countContiguousOnes(x)
% Evaluates the number of contiguous 'ones'
% https://de.mathworks.com/matlabcentral/answers/317399-count-number-of-consecutive-1-s-within-a-block

nmax=0;

    
function n = countContiguousOnes(x)
% Evaluates the number of contiguous 'ones'
% https://de.mathworks.com/matlabcentral/answers/317399-count-number-of-consecutive-1-s-within-a-block

nmax=0;

for i=1:length(x)
    x2 = circshift(x, i);
    f = find(diff([0,x2,0]==1));
    p = f(1:2:end