Not familiar with matlab programming 'language' but this from your listing looks wrong:
potmcmt=a.analogRead(0)/1024*5
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?
Lefty