the error indicates what's wrong: your image and your mask have different types (probably your image is e.g. uint8 and your mask is double). If you need your mask to have non integer values (e.g. 2.345), convert your image to double:
dblImage = double(yourImage);
Otherwise you might try to convert your mask to the same integer type as your image (by using uint8, ...).
Play games and win prizes!Learn more