how to use bytesavailablefcn ?
Mostrar comentarios más antiguos
hi
I definned bytesavailablefcn property from inspector like blow:

so whenever i need the "DATA" variable, it is update to last string from serialport. it works well.
but how i can define bytesavailablefcn from command line???
exceuse my english.
Respuestas (1)
Walter Roberson
el 8 de Sept. de 2016
Supposing s is the serial port object, then
set(s, 'BytesAvailableFcn', @(src, event) assignin('base','DATA', fscanf(src, '%s') )
for example.
Categorías
Más información sobre Serial and USB Communication en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!