Solved

MATLAB ZOS-API Confused with Mathematica

  • 26 August 2020
  • 1 reply
  • 47 views

Hello everyone,


 


I am a grad student at the University of Arizona and I am working on a project that will require me to make use of the MATLAB ZOS-API feature. While I have never used this feature before, I familiarized myself with enough of it to at least get started. I am running into the peculiar problem that when I click the feature within Zemax (either standalone application or interactive), instead of generating a Matlab code and opening the Matlab application, it instead opens and displays the code within Mathematica. I only recently installed Mathematica on my computer, and I do recall that before it was installed, Zemax would open up the Matlab application just fine. Interestingly, now I cannot get it to open up through Matlab. 


While I thought one solution would be to copy and paste the code into Matlab and then track down the directory that Zemax created within the ZOS-API Projects folder, this does not seem to be working. If anyone else has experienced a similar problem and can point out something I could do to correct or bypass this problem, it would be greatly appreciated!


 


Thanks,


Zack Hatfield

icon

Best answer by Allie 3 September 2020, 18:56

View original

1 reply

Userlevel 6
Badge +2

Hi Zack,


I have two ideas on this!


1. Check where MATLAB is defined in OpticStudio. This can be done by navigating to Setup...Project Preferences...Folders:


 



 


2. If that looks fine, then you will need to update the Windows Registry. It sounds like when you downloaded Mathematica, the program updated the Windows Registry so that '*.m' files were opened by it as the default program. You know when you right-click a document and select 'Open With...' then 'Always use this program to open this file type'? That is updating the extension information in the Windows Registry. Here is some information on updating your machine's settings so that MATLAB controls *.m files instead: https://www.lifewire.com/how-to-change-file-associations-in-windows-2624477.


 


Even if neither of those suggestions works, you can just make a new Matlab document with the appropriate boilerplate information. I'm attaching the Standalone and Interactive boilerplate for MATLAB. OpticStudio will usually create this file and store it in the {Zemax}\ZOS-API Projects folder. Standalone applications will have a function title which matches the name of the created file:


 



 


Alternatively - navigate to the {Zemax}\ZOS-API Projects folder, find the file, right-click it, and select Open With...:


 



 


Best,


Allie

Reply