I get this error while I tried to replicate the planar-silicon-solar-cell example from Planar silicon solar cell – Ansys Optics. The script provided is needed to model the I-V characteristics and calculate the efficiency. Error:.../solar_cell_electrical_results.lsf line 38: in expression A(i,...) the index was out of range I was simulating a 5 layer perovskite so I'm not sure what the issue is. The problem is with the following line: J = I/Lx/Ly*1000; # mA/cm^2 ?kern = find(J