GUIDE Serial help
1 次查看(过去 30 天)
显示 更早的评论
Hello guys. I am trying to define a serial object at the opening function. and I am a super beginner. I just want to know how to pass my objet to the other objects. It doesn't work when i try it. here is my current code:
serialptr = serial('COM9'); fopen(serialptr); serialptr.DataTerminalReady = 'on'; serialptr.RequestToSend = 'off'; fclose(serialptr);
I had to put this in every single button callback. Can anyone tell me how to do them in one callback and then send it to the rest. DTR, RTS will be changed in every function. Also I want to open port in one function and close it in another one. I tried nesting but didn't know how to nest all these callbacks into another one without damaging their properties. I really need an global object which will be used in every function and then saved in that function. does matlab have anything like C++ in hich u pass the refrence (pointer) and each function then could save everything onto the main object. Also in this matter security does not matter to me at all.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!