Accessing USB Port in Matlab/Psychtoolbox

692 Views Asked by At

I'm trying to access a buttonbox to record subject responses in matlab, but I can't access the usb port or the device attached. I've tried a lot of variations of the following code. what I currently have is:

    port = serial ('COM2', 'BaudRate', 19200);
    handle = CMUBox('Open', 'pst', port);

I keep getting all error messages either that I'm using the wrong argument type (referring to the 3rd arg 'port' in the second line) or that no such serial port device exists (again referring to 'port').

Any ideas?

1

There are 1 best solutions below

3
On BEST ANSWER

The input to CMUbox should be the port name, like 'COM2', not a port object, like the variable port. See the CMUBox docs for more details.

PS - Make sure that "COM2" is a correct port number. Often (not always) with Windows only COM3 and higher will be valid external devices.