ho907
Junior Member level 1
Hi,
I need help regarding serial communication using MATLAB. I know to open a serial communication the code is
obj = serial('COM1')
which configures the com port1 for serial communication. But if I want to change the code such way that
obj = serial('COMX')
where X is the number entered on a text box. For example if 2 is entered on a textbox so
X=2 and obj = serial('COM2'), which configures com port 2 for communication.
Please tell me how do I do that in matlab code. I have tried several ways but none of them worked.
Thanks in advance.
I need help regarding serial communication using MATLAB. I know to open a serial communication the code is
obj = serial('COM1')
which configures the com port1 for serial communication. But if I want to change the code such way that
obj = serial('COMX')
where X is the number entered on a text box. For example if 2 is entered on a textbox so
X=2 and obj = serial('COM2'), which configures com port 2 for communication.
Please tell me how do I do that in matlab code. I have tried several ways but none of them worked.
Thanks in advance.