The function "bwlabel" requires dynamic memory allocation (malloc) based on the content of the input image. When you label an image, the number of labels required is not known at compile-time. The number of labels varies based on image content. As per release R2015b, MATLAB Function block requires all functions to work without 'malloc', in other words it does not support dynamic memory allocation.
As per the latest release dynamic memory allocation is possible. By default dynamic memory allocation is enabled in the Configuration Parameters dialog box in the Simulation Target > Advanced parameters category you will find Dynamic memory allocation in MATLAB Function blocks
