MATLABでポートオブジェクトが残ってしまうと、以下のようなエラーメッセージが出てポートを開けなくなる。
エラー: serial/fopen (line 72) 開くことができません: Port: COM3 is not available. Available ports: COM1. Use INSTRFIND to determine if other instrument objects are connected to the requested device.
そのようなときは、
delete(instrfindall);
とコマンドを打つ。
参考文献: Error refreshing com ports - MATLAB Answers - MATLAB Central