I am using this function:
https://es.mathworks.com/help/matlab/import_export/use-events-and-callbacks-for-serial-port-communication.html
functi