Port: COM1 is not available

问题描述:
-----------------
>> s = serial('COM1', 'BaudRate', 9600)
-----------------
>> fopen(s)
??? Error using ==> serial.fopen
Port: COM1 is not available. Available ports: COM2.
Use INSTRFIND to determine if other instrument objects
are connected to the requested device.
-----------------
>> fwrite(s, 1)
??? Error using ==> serial.fwrite
OBJ must be connected to the hardware with FOPEN.

-----------------

使用INSTRFIND查找可用端口

--------------------
>> instrfind

   Instrument Object Array

   Index: Type: Status: Name:
   1 serial open Serial-COM1
   2 serial closed Serial-COM1
   3 serial closed Serial-COM1
   4 serial open Serial-COM2

---------------------

解决方法:

>> delete(instrfindall)

>> clear s

>> s = serial('COM!')

>>fopen(s)

你可能感兴趣的:(matlab)