How to connect Matlab to a virtual serial port on the Mac?

7 views (last 30 days)
I've set up a pair of virtual serial ports with which I am able to communicate via the Mac terminal, using 'screen /dev/master 9600' and 'screen /dev/slave 9600'. Unfortunately, I am completely unable to communicate with them using Matlab.
..I tried this:
serialport = serial('master');
set(serialport,'BaudRate',9600);
fopen(serialport);
fprintf(serialport,[1]);
.. and I get this:
Error using serial/fopen (line 72)
Open failed: Port: master is not available. Available ports:
/dev/tty.Bluetooth-Incoming-Port, /dev/cu.Bluetooth-Incoming-Port,
/dev/tty.Bluetooth-Modem, /dev/cu.Bluetooth-Modem.
Use INSTRFIND to determine if other instrument objects are connected to the
requested device.
.. please help..

Answers (1)

Walter Roberson
Walter Roberson on 11 Feb 2014
It appears that on OS-X, /dev/tty.* is expected and in particular for USB, possibly only /dev/tty.usbserial-* . The newsreader thread might be useful in configuring.
  1 Comment
Sonia
Sonia on 11 Feb 2014
Thanks for your help. Unfortunately I have not been able to resolve the issue.
To clarify, I am not using a USB device, only a virtual serial port between two pieces of software on the same machine. I have one program successfully listening to the paired port. I am hoping to get Matlab to act as an input, sending data through the virtual port. Unfortunately Matlab does not recognise the port. What you mentioned about tty.* appears to be the main issue.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!