- https://www.mathworks.com/help/matlab/ref/serialport.html
- https://www.mathworks.com/help/instrument/serialport.configureterminator.html
Problem with the odt notation of "configureTerminator" for serialport
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I do this with serial port:
sss=serialport('com1',9600)
Then, I try to configure the terminator with the dot notation:
sss.configureTerminator = 'CR'
I receive this error:
Assignment not supported because the result of method 'configureTerminator' is a temporary value.
If I do this:
>> configureTerminator(sss,'cr')
that works.
Why? I wrong something in the sintax?
All the other commnads I used like flush, write, writeline, read, etc have not shown problems with dot notation.
Tyhank you, Gianluigi
PS: This is my license:
-----------------------------------------------------------------------------------------------------
MATLAB Version: 24.1.0.2461801 (R2024a) Prerelease Update 1
MATLAB License Number: 566431
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 24.1 (R2024a)
Simulink Version 24.1 (R2024a)
Curve Fitting Toolbox Version 24.1 (R2024a)
Data Acquisition Toolbox Version 24.1 (R2024a)
Database Toolbox Version 24.1 (R2024a)
Instrument Control Toolbox Version 24.1 (R2024a)
Optimization Toolbox Version 24.1 (R2024a)
Parallel Computing Toolbox Version 24.1 (R2024a)
Simscape Version 24.1 (R2024a)
Simscape Electrical Version 24.1 (R2024a)
Symbolic Math Toolbox Version 24.1 (R2024a)
System Composer Version 24.1 (R2024a)
0 commentaires
Réponses (2)
Sarthak
le 16 Avr 2024
Modifié(e) : Sarthak
le 22 Avr 2024
Hello Gianluigi,
From what I could understand from the documentation of 'serialport', I can see that 'configureTerminator' is an object function and not an object property which could be accessed using the dot notation through assignment. The 'configureTerminator' function would set the terminator of the device that is passed to it i.e. the serialport device.
The error also states that 'configureTerminator' is a method and not a property. That is why you are unable to configure the terminator with the dot notation.
Please refer to the following documentation for more information on 'serialport' and 'configureTerminator'.
Hope this helps!
0 commentaires
Gianluigi
le 21 Avr 2024
2 commentaires
Sarthak
le 22 Avr 2024
Hi Gianluigi,
Yes, as I stated configureTerminator is an object function, which means you can call it on the object as the following and the dot notation will work
sss.configureTerminator('CR');
or use it conventionally like in the documentation shared as
configureTerminator(sss, 'CR');
Apologies for any confusions.
Cheers!
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!