


{"id":387184,"date":"2024-09-26T16:06:04","date_gmt":"2024-09-26T16:06:04","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/"},"modified":"2024-09-26T16:06:04","modified_gmt":"2024-09-26T16:06:04","slug":"387184","status":"publish","type":"reply","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/","title":{"rendered":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens"},"content":{"rendered":"<p>&lt;p&gt;Hi Zaka,&lt;\/p&gt;&lt;p&gt;Thank you for reaching out to us!&lt;\/p&gt;&lt;p&gt;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.&nbsp;&lt;br&gt;That said, if you are interested, I am attaching the MATLAB script for your reference.&nbsp;&lt;br&gt;You may find further help for connectiong MATLAB to OpticStudio via the ZOS-API here:&lt;br&gt;<a href=\"https:\/\/support.zemax.com\/hc\/en-us\/articles\/1500005488681-How-to-connect-to-the-ZOS-API-with-the-Interactive-Extension-using-MATLAB\" rel=\"noopener noreferrer\">How to connect to the ZOS-API with the Interactive Extension using MATLAB &ndash; Knowledgebase (zemax.com)<\/a>&lt;\/p&gt;&lt;p&gt;I believe that the data you are looking for are coming from the Surface Phase.&lt;\/p&gt;&lt;p&gt;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.&lt;\/p&gt;&lt;p&gt;&lt;span data-teams=&#8221;true&#8221;&gt;&lt;span class=&#8221;ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak&#8221; dir=&#8221;ltr&#8221;&gt;I hope that was helpful, let me know if I can be of further assistance.&lt;\/span&gt;&lt;\/span&gt;&lt;\/p&gt;&lt;p&gt;Kind Regards,&lt;\/p&gt;&lt;p&gt;Niki&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-387184","reply","type-reply","status-publish","hentry"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"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\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Ansys Learning Forum | Ansys Innovation Space\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum\" \/>\n\t\t<meta property=\"og:description\" content=\"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\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-09-26T16:06:04+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-09-26T16:06:04+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum\" \/>\n\t\t<meta name=\"twitter:description\" content=\"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\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/387184\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/387184\\\/#listItem\",\"name\":\"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/387184\\\/#listItem\",\"position\":2,\"name\":\"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum#listItem\",\"name\":\"Home\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#organization\",\"name\":\"Ansys Learning Forum\",\"description\":\"Ansys Innovation Space\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/387184\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/387184\\\/\",\"name\":\"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum\",\"description\":\"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\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/forums\\\/reply\\\/387184\\\/#breadcrumblist\"},\"datePublished\":\"2024-09-26T16:06:04+00:00\",\"dateModified\":\"2024-09-26T16:06:04+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#website\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/\",\"name\":\"Ansys Learning Forum\",\"description\":\"Ansys Innovation Space\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/forum\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum","description":"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","canonical_url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","position":1,"name":"Home","item":"https:\/\/innovationspace.ansys.com\/forum","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/#listItem","name":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/#listItem","position":2,"name":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/forum#listItem","name":"Home"}}]},{"@type":"Organization","@id":"https:\/\/innovationspace.ansys.com\/forum\/#organization","name":"Ansys Learning Forum","description":"Ansys Innovation Space","url":"https:\/\/innovationspace.ansys.com\/forum\/"},{"@type":"WebPage","@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/#webpage","url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/","name":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum","description":"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","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/#breadcrumblist"},"datePublished":"2024-09-26T16:06:04+00:00","dateModified":"2024-09-26T16:06:04+00:00"},{"@type":"WebSite","@id":"https:\/\/innovationspace.ansys.com\/forum\/#website","url":"https:\/\/innovationspace.ansys.com\/forum\/","name":"Ansys Learning Forum","description":"Ansys Innovation Space","inLanguage":"en-US","publisher":{"@id":"https:\/\/innovationspace.ansys.com\/forum\/#organization"}}]},"og:locale":"en_US","og:site_name":"Ansys Learning Forum | Ansys Innovation Space","og:type":"article","og:title":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum","og:description":"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","og:url":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/","article:published_time":"2024-09-26T16:06:04+00:00","article:modified_time":"2024-09-26T16:06:04+00:00","twitter:card":"summary_large_image","twitter:title":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens | Ansys Learning Forum","twitter:description":"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"},"aioseo_meta_data":{"post_id":"387184","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"content","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":true,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2024-10-28 16:25:45","updated":"2026-08-21 22:33:07","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/forum\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tReply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/innovationspace.ansys.com\/forum"},{"label":"Reply To: Request for Extracting and Saving Phase Data from Zemax for designing Metalens","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/reply\/387184\/"}],"acf":[],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/387184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/reply"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/replies\/387184\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=387184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}