function cleanWorkDir(workDir)
    if exampleUtils.folderExists(workDir)
        cd(workDir);
        dinfo = dir(workDir);
        for i = 1 : length(dinfo)
            if ~dinfo(i).isdir
                fileName = dinfo(i).name; 
                if endsWith(fileName, '.slx') 
                    bdclose(fileName);
                end
                delete(fullfile(workDir, fileName));
            else
                folderName = dinfo(i).name; 
                if ~(strcmp(folderName, '.') || strcmp(folderName, '..'))
                    rmdir(fullfile(workDir, folderName), 's')
                end
            end
        end
    end    
end