I just want to convert this python code to MATLAB. This is for serial porting. But I cant understand how to change this part of the code to MATLAB. Please help me out.
#Check Connected Ports
print("Checking Connected Ports")
Port=[]
ports = serial.tools.list_ports.comports(include_links=False)
for i in ports :
print('Port Found: '+ i.device)
Port.append(i.device)
print('Port List:'+ str(Port))
Below MATLAB command shows all of connected serial ports (in use serial ports):
ports = serialportlist
Below MATLAB command shows all of serial ports (in use or free serial ports):
ports = serialportlist("all")
Below MATLAB command shows available serial ports (not in use serial ports):
ports = serialportlist("available")
In all of above commands, return is a string array with the name of connected ports (or an empty string array if no port is in use), like below:
ports =
1×4 string array
"COM1" "COM3" "COM11" "COM12"
If you haven't any device (like Arduino Board) connected to your laptop, you can make virtual serial port using "Virtual Serial Port Driver Software".