How to define a "ValueChangingFcn" in a GUIDE definied slider

조회 수: 10 (최근 30일)
Csaba
Csaba 2020년 1월 4일
편집: Csaba 2020년 1월 5일
There is a "ValueChangingFcn" if I define a slider with uicontrol. I could not find it in the Property Inspector of the GUIDE slider.
Is there any way to define one for this slider as well?
Csaba

채택된 답변

Walter Roberson
Walter Roberson 2020년 1월 4일
uicontrol does not have ValueChangingFcn. That callback is only for App Designer "web figures" and never for "traditional figures", but uicontrol exists only for traditional figures.
The App Designer analog of uicontrol sliders is uislider()
If you need to know when a user has stopped moving a uicontrol slider then code the Callback property to start a timer object with the appropriate timeout. If Callback gets called again before the timer expires then restart the timer. Either way, timer was active or not, proceed with the work you would have liked to have done with a ValueChangingFcn callback if those existed. In other words uicontrol slider's equivalent to ValueChangingFcn is Callback property.
When the timer callback gets called, do the work that you would have liked to do in a ValueChangedFcn callback. uicontrol slider has no property equivalent to ValueChangedFcn callback, so this timer work is how you can do the equivalent.
If you want ValueChangingFcn but not ValueChangedFcn then do not bother with the timer, just use Callback property.
  댓글 수: 6
Walter Roberson
Walter Roberson 2020년 1월 5일
For frames after the first, I recommend updating the CData property of the image handle, instead of cla / imshow . imshow() can be somewhat slow.
Csaba
Csaba 2020년 1월 5일
Thanks, you are right. I have edited my code!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by