Your routine "segm" in file "gp.m" starts with
function segimage = segm(.... something )
but under at least some conditions, it does not assign any value to "segimage".
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!