execute zemax macro with mzdde
古いコメントを表示
I am trying to control Zemax with Matlab's mzdde.
I want to execute a Zemax macro using Matlab but can't figure out how. If the macro window is open and I use zPushLens, it will execute (since all windows are updated) but that isn't a very elegant solution. Someone suggested using the zGetTextFile with "Zpl" as the analysis type, but I don't see how that calls a specific macro.
Does anyone know how to call macros from Matlab?
回答 (1 件)
Indranil Sinharoy
2013 年 6 月 1 日
編集済み: Indranil Sinharoy
2013 年 6 月 3 日
1 投票
Try zOpenWindow(ButtonCode). Where the ButtonCode is the first 3 letters of the name of the ZPL macro. Note that the ButtonCode is case sensitive. However, there are certain limitations to this, which are:
1. Currently one can only "execute" a existing ZPL macro without modification.
2. If it is required to redirect the result of executing the ZPL to a text file, modify the ZPL macro in the following way:
(a) Add the following two lines at the beginning of the file:
- CLOSEWINDOW # to suppress the display of default text window
- OUTPUT "full_path_with_extension_of_result_fileName"
(b) Add the following line at the end of the file:
- OUTPUT SCREEN # close the file and re-enable screen printing
3. If there are more than two macros which have the same first 3 letters then all of them will be executed by Zemax.
Hope that helps.
1 件のコメント
Lydia
2015 年 4 月 8 日
Hi,I found this thread very helpful, however I have a related question: is there a way to interact with the macro while executing it? I am using a macro that requires user input before it executes further. Thanks!
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!