- Your project workflow, reproduction steps and the exact model so that we can reproduce issue at our end.
- Profiling function for your project. You can learn more abou profiling from the following links:-https://in.mathworks.com/help/matlab/matlab_prog/profiling-for-improving-performance.htmlhttps://in.mathworks.com/help/matlab/ref/profile.html
App Designer very slow for data acquisition
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I am working in imaging, I used to have an app from the previous guy working on my project on GUIDE, and since, I decided to work with App Designer and to migrate the GUIDE to AppDesigner (because Matlab was saying that GUIDE will be removed soon)
Basically, my code is a loop:
1/Move translation stage for raster scanning
2/Collection of data for 1 second into a vector
3/Writing this vector into a file via writematrix
4/Empty the vector and start again
My collection of data takes 1sec per loop (I asked Matlab to wait for 1sec), so you are expecting to have ~1s/loop (slightly more because you need to move the translation stage and write the data, but it's very fast ~0.1s).
The thing is, I noticed that my APP DESIGNER was getting very slow close to the end of the experiment, and every loop, MATLAB was getting slower to collect the data. I think that this problem comes from APP designer, because the same code on a .m script does not have this problem as you can see below:
I measured the time of the code at the end of each loop via tic and toc (one on APP DESIGNER and one on .m script)
First one: Code that I launched via APP DESIGNER
Actual: accumulated time of the data collection (showing that every loop, Matlab is getting slower to collect data)
Ideal: is the ideal plot (f(x) = x) just to compare
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/706982/image.png)
Second one: THE SAME CODE launched via a .m script
You can clearly see that the plot is a linear plot, Matlab is not getting slower to collect data every loop, as you might expect it.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/706987/image.png)
I am wondering if I should just write my code into lot of function with .m script, or if I can move it to GUIDE or SIMULINK?
The thing is I never worked with GUIDE and SIMULINK and I really don't want to spend time on it to find out at the end that I have the same problem that you can see with APP DESIGNER. Is it worth it to spend time on SIMULINK or GUIDE ? I would have liked to have an interface (and that's why I was on APP DESIGNER) but if it's affecting the speed of the data collection, I am OK to have a ugly code.
Any suggestion?
Many thanks,
CT
1 commentaire
Shivam Ahuja
le 20 Août 2021
I understand that your MATLAB and App designer is getting slower with the no of iterations increasing.
In order to learn more about your issue can you please share with us the following:-
Réponses (0)
Voir également
Catégories
En savoir plus sur Graphics Object Programming dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!