필터 지우기
필터 지우기

Create Editable Table rows by selecting item number in ListBox in App Designer

조회 수: 12 (최근 30일)
I have created a table with 8 rows and ListBox with 10 numbers in App Designer. Now I want to have a editable table rows ny selecting ListBox Item number. For example, if I click on 6 in ListBox item, 6 rows should be activated in Table with editable cells for data entry.
Done Following code but it throws error on command : for i=(nn+1):Nrows.
stiffness = get(app.UITable,'Data');
sz=size(stiffness);
Nrows=get(app.IsolatorsListBox,'Value');
Ncolumns=8;
set(app.UITable,'Data',cell(Nrows,Ncolumns));
nn=min([sz(1) Nrows]);
for i=1:nn
data_s{i,1} = stiffness{i,1};
data_s{i,2} = stiffness{i,2};
data_s{i,3} = stiffness{i,3};
data_s{i,4} = stiffness{i,4};
data_s{i,5} = stiffness{i,5};
data_s{i,6} = stiffness{i,6};
data_s{i,7} = stiffness{i,7};
data_s{i,8} = stiffness{i,8};
end
for i=(nn+1):Nrows %(error:For colon operator with char operands, first and last operands must be char.)
data_s{i,1} = '';
data_s{i,2} = '';
data_s{i,3} = '';
data_s{i,4} = '';
data_s{i,5} = '';
data_s{i,6} = '';
data_s{i,7} = '';
data_s{i,8} = '';
end

답변 (1개)

Prasanna Konyala
Prasanna Konyala 2022년 4월 1일
Hi Shashank
From my understanding it looks like Nrows is char and nn is number. That is why first loop ran without errors but second didn’t. Also, the above approach becomes complex and repetitive as you increase table size/list box size. There is an alternative solution for your desired functionality.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by