Predefine UI components (App Designer)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am making an app which generates all the components depending on an Excel-File.
It does work and the App is running, but Matlab keeps giving me the warning, that predefining the Components would be more efficent, because they're expanding in a loop.
One example for all the Switches I generate is below.
Commands like zeros(..) do not work, because afterwards the code doesn't work because of dot indexing ore something like that.
I hope that predefining the Components would be better for the performance for my app, but I don't know how..
I hope someone can help me - thank you very much!
Code example:
for i = 1:length(allKeysOne) %For Loop to create the Check Boxes
j = (ContPos(ContType(allKeysOne(i))));
%%% Label %%%
UniSwLabel(i) = uilabel(Tabs(TabNames(ContType(allKeysOne(i))))); %Creating a CheckBox
UniSwLabel(i).HorizontalAlignment = 'center';
UniSwLabel(i).FontSize = 14;
UniSwLabel(i).FontWeight = 'bold';
UniSwLabel(i).Text = allKeysOne(i); %Giving the CheckBox it's Text
ContSwNr(allKeysOne(i)) = i;
%%% Components %%%
UniSw(i) = uiswitch(Tabs(TabNames(ContType(allKeysOne(i)))), 'slider');
UniSw(i).ValueChangedFcn = @app.switchswitched; %Callback function
UniSw(i).FontSize = 16;
UniSw(i).Tag = allKeysOne(i);
UniSw(i).FontWeight = 'bold';
%%% ....%%%
end
0 commentaires
Réponses (0)
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!