What is an "out double" value in the ZOS-API?
Best answer by Allie
When a value is designated as a "double" or "int", it is asking for a numerical input from the user. Conversely, an "out double" or "out int" variable is one that is output as a result of the user inputs. This distinction allows a single API command to output multiple variables in one call.
Some commands that use this syntax are found in the IBatchRayTrace interface: GetDirectFieldCoordinates and GetPhase.

GetDirectFieldCoordinates is a "bool" type while GetPhase is a "void" type. This means that in addition to the "out double" variables, GetDirectFieldCoordinates will also output a true or false statement indicating whether it has successfully evaluated or not. It will therefore require an additional "out" variable to be defined in the beginning of the call. That is represented by "result" below.
In Matlab, these two commands may be evaluated by using the following structure:
raytrace = TheSystem.Tools.OpenBatchRayTrace();
% GetDirectFieldCoordinates
% Result is the Boolean output, "X, Y, Z, L, M, N" are the "out double" variables as defined in the syntax guide
[result,X,Y,Z,L,M,N] = raytrace.GetDirectFieldCoordinates(wavenumber, ZOSAPI.Tools.RayTrace.RaysType.Real, hx, hy, px, py);
% GetPhase
% Result is the Boolean output, "exr, exi, eyr, eyi, ezr, ezi" are the "out double" variables as defined in the syntax guide
[exr,exi,eyr,eyi,ezr,ezi] = raytrace.GetPhase(L, M, N, jx, jy, xPhaseDeg, yPhaseDeg, intensity);
raytrace.Close();
Sample 5 – "Parsing a ZRD File" – provides an example of using "out" variables from the IZRDReaderResults interface to obtain ZRD information.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.