Guilin Sun
Ansys Employee

Perhaps you are not familiar to scripting. The question mark is to output the data. You did not provide the data from the bottom of the script file, so no further suggestion is available. Maybe you can check if J has negative values. If not, then 

kern=0 so J(kern) will fail.

On the other hand, you should not use  kern=length(kern) since kern should be one value, scalar, not a matrix. Please delete line 34. and check the result.

Please note that line 37 is to cacualte the matrix difference. If the matrix fails, or the denominator is zero, line 37 will fail.

 

Please watch some script videos once this issue is solved. https://optics.ansys.com/hc/en-us/sections/360007813714-SCRIPTING100-List-of-videos

 

kern