Python How To Use Global Variables Matlab For Loop