App Designer - how to run code before components are created?
32 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I would like to run MATLAB code before the components of the app are initialized. The default workflow is
function app = time_evolution_app_R2_0_v18_resized
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.MulticellularModelSimulatorUIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
Therefore, the first editable code is placed after createComponents() and registerApp() are called. Is there any way to place code before runStartupFcn()?
Specifically, I have a bunch of graphics I use for buttons in the app, which I would like to store in a subfolder. However, the only possibility seems to either (1) place the graphics in the same folder as the app, (2) manually add the subfolder with graphics to my MATLAB path. Is there any way to automatically add a subfolder to the path when running the app, before the app components are created?
7 commentaires
Will Reeves
le 14 Mar 2023
Modifié(e) : Will Reeves
le 14 Mar 2023
Can I confirm that since October 2019 this reasonable "feature request" hasn't been included?... Or maybe an "advance mode" option that allows a user to freely edit all areas of code?
Kevin Holly
le 28 Mar 2023
As of R2022a, images do not need to be on the MATLAB path to be used in App Designer.
properties (Access = private)
dummyvariable = addpath('./icons')
end
Réponses (1)
Laura V.
le 17 Avr 2023
I'm dealing with the same problem but due to another reason. I would like to implement a Matlab version check before createComponents. Implementing a version check in startupFcn would be too late for features like wordwrap that cause an error with older Matlab versions in createComponents....
0 commentaires
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer 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!