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: gamutation.m
    path of file: ./repos/opt_matlab/第21章/例21.3
    
    the code of the file until where you have to start completion: function pop=gamutation(pop,pm,varargin)
popsize=size(pop,2);
genelen=length(pop(1).x);
if strcmp(varargin{1},'b')
    for i=1:popsize

    
function pop=gamutation(pop,pm,varargin)
popsize=size(pop,2);
genelen=length(pop(1).x);
if strcmp(varargin{1},'b')
    for i=1:popsize
      for j=1:genelen
        test=rand;
        if test<pm
            pop(i).x(j)=abs(pop(i).x(j)-1);
        end