Calling App Designer object methods from within Timer Callback

Within my app in App Designer I have an object X with its own class methods. I am trying to call this method on a schedule using a timer object within the app. However, whenever I try to do this I get an error from the timer callback function library. It seems that the method call might be being interpreted as another timer callback function though I'm not sure? I have other timer functions that just set application properties (app.Y = 'on') without issue.
What could be the cause here?
The callback function is set here:
app.pageTimer.TimerFcn = @app.timer_event;
and defined here:
function timer_event(app, obj, event)
if app.property
app.X = app.X.method() % call the method on app object
end
end
//EDIT for Error Message. - Throw by timercb.m
Error while evaluating TimerFcn for timer 'timer-19'
Brace indexing is not supported for variables of this type

댓글 수: 2

Please give full error messages if you get an error, it is a lot easier than you interpreting the error and passing that on, which may or may not be a correct interpretation of it.
I did't see any error.
where do you put your function timer_event(app, obj, event)?

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

 채택된 답변

Mike Scott
Mike Scott 2018년 10월 24일

0 개 추천

Found the answer thanks Adam and Kevin.
The problem was arising in part of the called function. I am a newbie to MATLAB, it looks as though the error handling is different when executing as part of a timer callback.
Instead of performing a trace to flag the offending function it looks like MATLAB routes any error through the timer callback handling, hence my confusion.
thanks

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

질문:

2018년 10월 24일

답변:

2018년 10월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by