Skip to main content
Solved

NSC RayTrace "ClearDetectors" error in Interactive mode with Matlab

  • Feb 27, 2022 8:32 PM UTC
  • 3 replies
  • 681 views

joshdfreeman
Ultraviolet
Forum|alt.badge.img

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? 

Best answer by joshdfreeman

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

Will try this and see if that makes a difference!

View original

3 replies

joshdfreeman
Ultraviolet
Forum|alt.badge.img
  • Author
  • Ultraviolet
  • Answer
  • Feb 27, 2022 8:53 PM UTC

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

Will try this and see if that makes a difference!


joshdfreeman
Ultraviolet
Forum|alt.badge.img
  • Author
  • Ultraviolet
  • Mar 1, 2022 5:11 AM UTC

@ Julia’s post above worked! 


  • Monochrome
  • Jul 2, 2023 7:29 PM UTC

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.