Well this seems to be a cross posting of one you already made? That tends to piss off the moderators here. Anyway I responded to your first post about a possible programming error, but as I don't know metlab I can't say the for sure. Anyway:
Not familiar with matlab programming 'language' but this from your listing looks wrong:
No trailing ;
And not sure if integer math will work as truncation/rounding, will kill that calc, no?
Or is matlab converting the components to floating variables. I can't even see where
the potmcmt variable is declared?