Javascript Function Loop Through Array Matlab Simulink Electrical Circuit