- Install a compatible compiler (Home<Environment<Add-ons<Get Add-ons) and configure the MATLAB to use the compiler by running the command: "mex -setup"
- Create a C or C++ file that includes 'libusb' and implement the required functionality. Use the mex function signature to interact with MATLAB. Below is a boiler plate code which can be extended to the required functionality.
- Compile the mex file: Use the mex command to compile your mex file, specifying the path to 'libusb'
- The above command will generate a 'mex' file, which can be called like any other MATLAB function
- mexFunction: https://www.mathworks.com/help/matlab/apiref/mexfunction.html
- path to include file: https://www.mathworks.com/help/matlab/ref/mex.html#btxy24r-1
- path to library file: https://www.mathworks.com/help/matlab/ref/mex.html#btx0rai-1