- If the function is large, it may be cleaner to store it independently from the app.
- If other functions/app use the function stored in the m-file, then it makes sense to keep that function separate from the app.
Figure in a tab group in app designer
8 views (last 30 days)
Show older comments
Hi all,
After my first question regarding data analysis, I would like to ask something about the app desinger. I am familiar with guide and I learned a lot about app designer but I struggle a bit as it's quite different from what I used back in ... 2007...
I have an app with the following layout.
When the button 'Run' is pressed, an 'm' file is executed.
When the 'Clear All' button is pressed, the code in that callback is executed to reset and clear all values.
- Relative question : Debugging aside, is there any other reason to call 'm' files instead of just putting the code in that callback?
Now, I have tried to embed the multiWaitbar code (found in this forum) onto the app, but I was unsuccesful. To that end I thought about the gauges that the app designer now has, so it's still a graphical representation of the progress.
The same happened with a figure that is created with a surf command. The idea would be to plot different figures in the tab group so all will be on one big window therefore easier to analyse with their relevant data etc.
Your help is much appreciated,
D.
0 Comments
Answers (1)
Adam Danz
on 30 Aug 2021
> is there any other reason to call 'm' files instead of just putting the code in that callback?
IMO there are 2 reasons to call a function written in an independent m-file within a callback function rather than locally storing the function within an app.
Notice that I'm describing the content of the m-file as a function. It is not recommended to use scripts in this context (see documentation: scripts vs functions.
Regarding the second part of your question, there's no reason a multi-wait-bar display could not be programmed in an app panel. Decide whether you want to display wait-time as a shown in your image or as guages and then fix the errors that are preventing you from achieving those goals. Without more info about the problems that are preventing you from succeeding, I can't recommend a solution.
6 Comments
Adam Danz
on 31 Aug 2021
I know what you're talking about. During the 2nd year of my graudate program I took the summer to rewrite all of my previous coding to clean it up so I could make sense of it. It turned out to be a good investment since I often go back to the cleaner versions of those programs to make quick changes or to interpret an output.
See Also
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!