Figure in a tab group in app designer

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.

Answers (1)

Adam Danz
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.
  1. If the function is large, it may be cleaner to store it independently from the app.
  2. If other functions/app use the function stored in the m-file, then it makes sense to keep that function separate from the 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

Thanks for the quick answer.
Another benefit I think for using them inside the app designer is the automatic update of the descriptions.
As far as the bar is concerned, for the time being it is ok to have it separately, so we are good with that.
Many thanks once gain,
Dimitri
What is the "the automatic update of the descriptions" ? I'm not familiar with this.
May be it is my description error (99%), but let me explain.
I mean that when you add a new button, you get a description. For example app.RunButton . This is a button with the text ''Run'' written on it. Now, if you change that in the app designer to something like ''Execute'' , code in the design view, wherever it is, is updated automatically. So the app.RunButton becomes app.ExectuteButton. This is really helpful compared to having it in a file where you have to look at each component serarately.
Ah, I see. Thanks for the explanation.
Happy to somehow help! I wrote a bit of a program back in 2002 to calculate the 3D envelope of a loading arm and then a large program back in 2007 to predict the shot peening effects in gear steels. It was a huge task for me back then. Large chunk of code with GUI (guide back then), and I am still mesperised when I dig my notes and see the .m files, the thinking, the callbacks on the gui elements... I think programming makes you a different person (thinking wise) and it is nice to get back to it. I find that appdesigner is a huge leap forward and these little details, along with the comments on the side which help you to even put ';' so that the value is not displayed on the screen is amazing.
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.

Sign in to comment.

Categories

Find more on App Building in Help Center and File Exchange

Products

Release

R2021a

Commented:

on 31 Aug 2021

Community Treasure Hunt

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

Start Hunting!