I want to send a matrix to arduino by matlab but i m unable to open the serial port. using command 'instrfind' i get the status of com3 as close. so fopen() command doesnt execute it gives an error message (Open failed: Port: COM3 ). what to do now?

1 Ansicht (letzte 30 Tage)
I want to send a matrix to arduino by matlab but i m unable to open the serial port. using command 'instrfind' i get the status of com3 as close. so fopen() command doesnt execute it gives an error message
Open failed: Port: COM3 is not available. No ports are available. Use INSTRFIND to determine if other instrument objects are connected to the requested device
By instrfind command i am getting Instrument Object Array
Index: Type: Status: Name:
1 serial open Serial-COM3
2 serial closed Serial-COM3
what to do now?
  1 Kommentar
Bushra Ali
Bushra Ali am 10 Mai 2018
after clearing the workspace I run the instrfind command again and get these results. Can someone plz specify where I am going wrong.
instrfind
Serial Port Object : Serial-COM3
Communication Settings
Port: COM3
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: closed
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Madhu Govindarajan
Madhu Govindarajan am 10 Mai 2018
Clearing the workspace is not sufficient to delete existing connections. Try
>> delete(instrfindall)
This should delete existing connections. Then you should be able to create a new connection by typing
>> s1 = serial('COM7')
>> fopen(s1)
Madhu
PS - Accept the answer if this works. I feel like this will be a frequent flyer and would be great to establish an answer that works for everyone.
  4 Kommentare
Madhu Govindarajan
Madhu Govindarajan am 10 Mai 2018
Here are my thoughts - MATLAB and Serial monitor are fighting for the same resource. So maybe if you close the connection once you are done sending, then hypothetically you should be able to open Serial monitor after that. But all of this is manual and might not work for you, best would be to test it manually and then use the digital pin like you are doing to test if you received the data.
HTH, Madhu

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by