Is there a way to iterate through numbered UI components in app designer?
조회 수: 6 (최근 30일)
이전 댓글 표시
I have the following code in an appdesigner app that allows users to select multiple files (up to 10), read them, plot data on a UI axis, and report values in a UI table. All of the selected files will be included in the table and plot, but the user needs the option to exclude some of the data from statistical analysis that is performed in a different callback. I've accomplished this by using check boxes to the left of each row of the table (named app.CheckBox_# where # = 1-10).
for i = 1:numel(filename)
app.data.suite(i).spec = readcell([pathname, filename{i}]);
% Read in force and displacement data
for k = 2:length(app.data.suite(i).spec)
app.data.AxDisp(i).vec(k-1) = app.data.suite(i).spec{k,3};
app.data.AxForce(i).vec(k-1) = app.data.suite(i).spec{k,2};
end
%Plot each data set
plot(app.UIAxes2, app.data.AxDisp(i).vec,app.data.AxForce(i).vec,'LineWidth',1);
%Calculate parameters
app.data.maxload(i) = max(app.data.AxForce(i).vec); %lbs
app.data.thickness(i) = cell2mat(app.data.suite(i).spec(4,8));
app.data.diameter(i) = cell2mat(app.data.suite(i).spec(3,8));
%Determine strength
switch app.PlatenTypeDropDown.Value
case 'Curved'
app.data.strength(i) = (1.272*app.data.maxload(i))/(pi*app.data.diameter(i)*app.data.thickness(i));
case 'Flat'
app.data.strength(i) = (2*app.data.maxload(i))/(pi*app.data.diameter(i)*app.data.thickness(i));
end
%Populate UI table
app.UITable.Data(i,2) = num2cell(app.data.maxload(i));
app.UITable.Data(i,3) = num2cell(app.data.strength(i));
end
I would like to add a section in the above loop that would toggle on each numbered check box based on the same numel(filename) condition as shown below.
for i = 1:numel(filename)
app.Checkbox_(i).Value = 1
end
Is there a way to iterate over numbered checkboxes (and other numbered UI components)?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!