Solar Photovoltaic (PV) arrays consist of modules that are connected to generate the power required by the loads. The arrays are expected to generate the maximum power based on the irradiance at the site but, in the field, this condition gets affected by the frequently occurring partial shading. The effect of partial shading is so large that it can reduce the power output of the arrays to zero and creates complications such as hotspots in modules, power losses, and distorted power curves. To overcome these complications, this paper proposed a reliable technique that uses a switching matrix circuit to effectively distribute the current in the array under partial shading. The proposed switching matrix determines the optimal electrical connection of the modules based on the minimum row current difference approach which is calculated using the particle swarm optimization algorithm to enhance the power output of the PV array during partial shading. The system has been tested for a 7x4 unsymmetrical array that uses 56 switches to reduce the losses in the array and enhance the power during partial shading. The investigation is conducted in MATLAB simulation and the proposed system is compared with conventional, hybrid, and existing static reconfiguration techniques under partial shading. The analysis conducted shows that the proposed system has 53.95%, 46.2%, 45.9%, 26.3%, and 20.94% of average power improvement than the SP, TCT, SP-TCT, SDS, and FER respectively.