Why "timerfcn" do not recognize handles
Show older comments
I am using "timerfcn" to simulate a plot. code was working fine. But when i used it in gui, timerfcn stopped recognizing the defined variables; handles. how to pass handles form callback functions to timerfcn. I have labeled screen shorts to explain the error.
I defined handles L1,L2,L3,L4 and th in OpeningFcn to plot initial static graph

Then i used timerfcn inside Callback function of a "checkbox" labeled as "Animate" . It can be observed that handles are working fine outside timerfcn but are not recognized by the function.

What is recommended way of doing it? Is there any way to export these handles to base workspace so that timer function can work?
4 Comments
Sean de Wolski
on 14 Dec 2021
You should really consider using App Designer instead of GUIDE.
Walter Roberson
on 15 Dec 2021
Managing larger code bases is still a substantial challenge in App Designer -- and at least until recently, the problems started about the 1000 lines of code point.
Sean de Wolski
on 15 Dec 2021
That just means the chosen architecture is bad. With component containers now allowing you to build modular components there's no reason an app ever needs to get that large. Pair that with model-view-control or a modified-model-view-control that does view/control in app designer and a data model class these problems are completely avoidable for large scale apps.
Walter Roberson
on 15 Dec 2021
About 3 months ago, a number of us met with one of the managers for App Designer. The manager said nothing about modular components as being a potential cure for the performance problems that we were talking about.
The manager also had no resolution for the problem that the IDE for code that is outside of App Designer (such as a "data model class") is in a different window than the IDE for App Designer, making it a challenge to split the design in the way you are recommending.
Telling people that they have to refactor their design into smaller pieces to get around the fact that 5000 lines of code can take up to 20 minutes just to scroll is not an acceptable solution to the performance problems of App Designer.
There are two separate but related issues here:
- Performance of code built with App Designer. Mathworks has put a lot of effort into that, and in particular says that R2021b is significantly improved
- Performance and usability of App Designer itself for creating code. This continues to be a challenge.
Users have been posting saying that their team of programmers spent multiple months converting their projects to App Designer, and are finding that they have to convert back because App Designer is, in their experience, not workable for medium or large sized projects.
As far as I am concerned, App Designer is still only suitable for Prototype stage. That does not mean it does not have value, but blanket recommendations of "really should" switch to App Designer are rather premature in my opinion.
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!