Python Function Change Input Variable Matlab For Loop