We are proud to announce a new tutorial on interfacing MATLAB with our beam profilers. An interface to MATLAB is useful given the variety of data processing toolboxes MATLAB provides. The Math, Statistics, and Optimization toolbox are useful for analyzing data with MATLAB. Additionally, the great variety of tools such as image processing, signal processing, curve fitting, and machine learning, make MATLAB an excellent platform for custom interfaces with both DataRay beam profiling cameras (e.g. the WinCamD) and scanning slit devices (e.g. BeamMap2). Because the DataRay OCX is 32-bit, it is necessary to use a 32-bit version of MATLAB. Before writing an interface to the DataRay OCX, we recommended familiarizing yourself with the operation of the DataRay program.
First, the tutorial explains how you can create a graphical user interface with MATLAB’s GUIDE and ActiveX controls from the DataRay program. The DataRay OCX has ActiveX controls which allow interfaces to communicate with and display results from the DataRay software. This communication can be used to both change settings and receive data. Though the ActiveX controls are mostly the same between beam profiling cameras and scanning slit devices, some of the ID’s of the associated ActiveX controls change; to make an interface with a scanning slit device, you need only change the ID’s of the buttons and profiles. We have example MATLAB interfaces for the WinCamD cameras as well as the Beam'R2 beam profilers on our website to get you started.
After explaining how to create a basic interface, the tutorial shows how to collect raw data from the WinCamD beam profiling camera and write it to a .csv file, a common format which can be analyzed in Excel or in many programming frameworks. Though most developers take advantage of the calculations and processing techniques provided by the DataRay software, some find it useful to work with the raw data provided by the OCX.
In addition to explaining how to collect raw data from the OCX, the advanced section of the tutorial explains how to setup and use MATLAB GUI controls. The GUI controls provided by MATLAB’s GUIDE are very useful for any interface that might include reading and writing files, using custom settings, or taking custom actions.
Finally, the tutorial explains how to assign a callback function to an ActiveX event in MATLAB. While earlier sections of the tutorial describe how controls communicate to the OCX, the last section describes how events allow the OCX to communicate back to the interface. The tutorial explains how to trigger a callback function when a new frame is available which allows developers to collect data at regular intervals and coordinate usage of beam profiling cameras with other equipment such as translation stages.
In the interfacing section of our website, you can find an example interface for the BeamR2 scanning slit device as well as tutorials for developing interfaces in C++, Visual Basic, LabVIEW, MATLAB and Python. Finally, there is the DataRayOCX documentation file which is useful for finding the methods and properties of ActiveX controls. If you have any further questions on interfacing MATLAB feel free to contact us.
Our interface was developed in collaboration with Dr. Philipp Metz of Hell Gravure Systems, Germany. He demonstrated the setting of controls onto GUI panel at runtime. We would like to thank him for his helpful feedback on our interface and products as well.