Skip to main content

Could anyone help troubleshoot an error when running the NSC RayTrace in Interactive Extension mode from Matlab - ‘Unrecognized field name "ClearDetectors".’?

The code always runs the first time through, and then the second time through the below routine, either in the same program execution or after stopping and starting again, it hangs up on NSCRayTrace.ClearDetectors(0);                  

                    % Ray Trace

                        % Create ray trace

                        NSCRayTrace = TheSystem.Tools.OpenNSCRayTrace();

                        NSCRayTrace.SplitNSCRays = false;

                        NSCRayTrace.ScatterNSCRays = false;

                        NSCRayTrace.UsePolarization = true;

                        NSCRayTrace.IgnoreErrors = true;

                        NSCRayTrace.SaveRays = false;

                        NSCRayTrace.SavePaths = true;

                        NSCRayTrace.SavePathsFile = 'Simulation_temp.PAF';

                        NSCRayTrace.ClearDetectors(0);

                      % Run ray trace

                        NSCRayTrace.RunAndWaitForCompletion();

                        NSCRayTrace.Close();

The code was working most of the time, occasionally generating the error and was was sort of ignorable / manageable, through restarting Matlab and OS. Now it consistently generates the error and stops program execution every second and further time through the routine and is an obstacle to moving forward.

Any thoughts? 

May have found a possible solution posted by @Julia last year. 

Will try this and see if that makes a difference!


@ Julia’s post above worked! 


This error occurs in the sample Matlab code whenever the testfile is a non-sequential only model.

MATLAB_02_NSC_ray_trace.m error at NSCRayTrace.ClearDetectors(0);

./..

% Set up primary optical system

TheSystem = TheApplication.PrimarySystem;

TheSystem.MakeNonSequential();

sampleDir = TheApplication.SamplesDir;

This is an error in the sample code.


Reply