Predefine UI components (App Designer)

1 回表示 (過去 30 日間)
Ahmet Sahin
Ahmet Sahin 2019 年 11 月 6 日
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 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by