Niki Papachristou
Ansys Employee

Hi Zaka,

Thank you for reaching out to us!

I believe that for this example the target phase map was pre-created by MATLAB using the ZOS-API MATLAB Interactive Connection, and then the created .mat file was loaded to Lumerical by the stitch_nearfield_ZOS_R100um.lsf script. This means that we connected to OpticStudio from MATLAB using the ZOS-API, pulled the polynomial coefficients to MATLAB, created the target phase map in MATLAB, and saved the data as a native .mat file, which can be read by Lumerical using the matlabload function. Even though it is possible to follow this way using MATLAB, I would suggest to directly re-create the target phase profile in Lumerical instead, as done in the other stitch_nearfield_R11um.lsf example, because the size of the generated .mat file rapidly increases with the size of the metalens, so while the MATLAB workflow works smoothly in case of smaller scale metalenses, it will be problematic for larger scale metalenses over the 1 mm semi-diameter size. Involving MATLAB and the ZOS-API connection is not necessary for the workflow, the same results can be achieved by re-creating the phase profile in Lumerical based on the phase equation and polynomial coefficients from Zemax. 
That said, if you are interested, I am attaching the MATLAB script for your reference. 
You may find further help for connectiong MATLAB to OpticStudio via the ZOS-API here:
How to connect to the ZOS-API with the Interactive Extension using MATLAB – Knowledgebase (zemax.com)

I believe that the data you are looking for are coming from the Surface Phase.

Unfortunately, currently I am not able to provide you with the exact script to use, but I am hoping you can built one from your side based on my above response.

I hope that was helpful, let me know if I can be of further assistance.

Kind Regards,

Niki

 

Â