We present a new Matlab toolbox for generating phase and amplitude patterns for digital micro-mirror device (DMD) and liquid crystal (LC) based spatial light modulators (SLMs). This toolbox consists of a collection of algorithms commo. We present a new Matlab toolbox for generating phase and amplitude patterns for digital micro-mirror device (DMD) and liquid crystal (LC) based spatial light modulators (SLMs). This toolbox consists of a collection of algorithms commonly used for generating patterns for these devices with a focus on optical tweezers beam shaping applications. In addition to the algorithms provided, we have put together a range of user interfaces for simplifying the use of these patterns. The toolbox currently has functionality to generate patterns which can be saved as an image or displayed on a device/screen using the supplied interface. We have only implemented interfaces for the devices our group currently uses but we believe that extending the code we provide to other devices should be fairly straightforward. T. Optical tweezersStructured Light MethodsDigital micro-mirror deviceSpatial light modulatorBeam shaping using computer controlled spatial light modulators is useful in many fields with applications in imaging, optical tweezers, and optical fabrication. In optical tweezers, beam shaping is used to generate the beams used to optically confine the particles under study, construct elaborate imaging systems,, and for fabricating probes and structures that can be optically trapped. A modern optical tweezers system typically consists of a laser, a system for shaping the laser beam, a high numerical aperture objective, the sample, a condenser and the imaging/detection system. Such a system enables numerous studies to be conducted in highly versatile fields including biology, physics and engineering,. Optical tweezers are also being used in quantum opto-mechanics in studies concerned wit. 2.1. Device overview and operationThere are a variety of systems used for beam shaping, but among the most common are amplitude and phase spatial light modulators, such as the digital micro-mirror device (binary amplitude SLM, or DMD) or liquid crystal (phase SLM), 1 These highly configurable devices can be controlled using a variety of different interfaces but a common method is to connect them as an additional screen on the lab computer. The image displayed on the screen corresponds to the amplitude or phase pattern displayed on the device. There are numerous guides for setting up one of these devices in an optical tweezers system,, and many of these guides describe generating SLM patterns for beam shaping but they do not provide easy to u. The Matlab toolbox is broken up into the following sub-packages:••Simple patterns otslm.simple••Iterative methods otslm.iter••Pattern tools otslm.tools••Utility functions otslm.utils••.