Okay I realized that watershed is only available for codegen for Matlab version R2015a onwards. I am using R2014b.
https://www.mathworks.com/help/coder/release-notes.html
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!