OsensaMatlab (by Hisham Assi) tells Matlab users how to access the python library osensapy in Matlab. Osensapy a Python module interfacing with the OSENSA transmitters.
- First, you need to configure your Matlab system to use Python.
- Then you need to install osensapy:
pip install osensapy
; make sure to install it in the same python environment that you linked to Matlab. - Import osensapy by this Matlab command:
osensapy=py.importlib.import_module('osensapy')
, the outcome will be somthing like:Go to thisosensapy = Python module with no properties. <module 'osensapy' from 'path\\ to\\ osensapy\\ __init__.py'>
osensapy
folder, first, delete the file__init__.py
, then rename the fileosensapy.py
to__init__.py
- Now you can access the
Transmitter
calss methods by calling the Matlab functionwheretransmitter=get_osensa_transmitter(port_name)
port_name
is the name of the serial port connected to Osensa transmitter (for example'COM5'
) - All the the Transmitter function descibe in OsensaPy Guid , namley, the ones with format
transmitter.some_function()
can be accessed with same way. For eaxample to read the transmitter serial number, one needs to use Matlab commandNote the commandtransmitter.read_serial_number()
transmitter.fast_batch(3)
needs to be, in Matlab:transmitter.fast_batch(uint16(3))
- Don't forget to close the transmitter when you are done
transmitter.close()