GUIDE Flow and Functions

조회 수: 5 (최근 30일)
Martin Thompson
Martin Thompson 2018년 2월 15일
댓글: Martin Thompson 2018년 2월 15일
I am using GUIDE to create a UI.
How can I create functions that run in the background? I assume the program loops through checking for UI events related to the listed callbacks, however I would also like to have functions that run independently of user interaction.
I only know of the timer object, but I may also like to have functions that are conditionally run etc. or just at a predetermined order in program flow.
Is there any way of doing this without coding the app programatically, as we would like to expedite the GUI by using GUIDE?
Cheers
  댓글 수: 7
Geoff Hayes
Geoff Hayes 2018년 2월 15일
편집: Geoff Hayes 2018년 2월 15일
Martin - could you use a timer to communicate with your serial port object? The timer could be started and stopped from within the GUI, and would continuously poll (?) your serial port object for new data. See https://www.mathworks.com/matlabcentral/answers/284202-how-to-plot-a-real-time-signal-with-axes-automatically-updating for an example.
Martin Thompson
Martin Thompson 2018년 2월 15일
Cheers Rik. Hi Geoff, that's a good idea, but I think that the solution lies in using BytesAvailableFcn which generates an event when a certain number of bytes are available on the input buffer. I can then specify the callback function for use with the event.
I am now looking at defining my own events that I can associate with certain callback functions in the opening function of the GUIDE generated code (for conditional executions where there are no predefined event generating functions). However this may require linking to a library or something more complicated, so if you still might know where I could put general code that could be useful.
CHeers

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by