numlabels = max(L(:));
blue=[0,0,1];
red=[1,0,0];
green=[0,1,0];
cmap=repmat(blue, [numlabels, 1]); % create color map, default color is blue
cmap([2,4,8], :)=repmat(green, [3,1]); % change color map to green for label 2,4,8
cmap([5,6,11], :)=repmat(red, [3,1]); % change color map to red for label 5,6,11
RGB2 = label2rgb(L,cmap,'k'); % 'k' is black background color, see help
imshow(RGB2)