Skip to main content
Question

can I import an excel table as merit function?


icybird

I want to create a long merit function with large number of duplicated operand and the input values are results from some formula operation. Can I create the merit function in excel and then copy or import it to the ZEMAX?

Or is there a ZPL commend to use to insert operand into a MF?

 

Thanks very much.

2 replies

Sean Turner
Ultraviolet
Forum|alt.badge.img+1
  • Ultraviolet
  • 88 replies
  • December 6, 2023

You can copy an excel table into the merit function editor, but it's not very convenient if the merit function is long. This is one area I think the OpticStudio editors could be improved. When copying a m x n array of cells from excel, you need to highlight the same m x n cells in the zemax editor in order for all of the cells to be pasted. So in your case, you would need to have an equal number of merit function operands already inserted into the merit function editor as you have operands in the excel file. Then you need to highlight all of the rows in the merit function editor, right click, and choose “Paste Cells”. 

It would be simpler to copy the excel data into a txt file and save it with the .MF extension. Then you can load all of the operands into the merit function editor. 

There is a ZPL keyword INSERTMFO to insert an operand into the merit function. Use this in combination with SETOPERAND to define your merit function with a ZPL script.


icybird
  • Author
  • Infrared
  • 11 replies
  • December 6, 2023

Hi Sean,

Thanks  a lot for these helpful hints. That is exactly what I needed.

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings