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: deislands2d.m
    path of file: ./repos/fecgsyn/subfunctions/data-generation/libs/iso2mesh
    
    the code of the file until where you have to start completion: function cleanimg=deislands2d(img,sizelim)
%
% cleanimg=deislands2d(img,sizelim)
%
% remove isolated islands on a 2D image below speicified size limit
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
%

    
function cleanimg=deislands2d(img,sizelim)
%
% cleanimg=deislands2d(img,sizelim)
%
% remove isolated islands on a 2D image below speicified size limit
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
%
% input:
% 	img: a 2D binary image
% 	sizelim: a integer as the maximum pixel size of a isolated region
%
% output:
% 	cleanimg: a binary image after removing islands below sizelim
%
% -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
%

img=squeeze(img);
maxisland=-1;
if(nargin==2) maxisland=sizelim; end