Create Editable Table rows by selecting item number in ListBox in App Designer
5 ビュー (過去 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
0 件のコメント
回答 (1 件)
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.
Please refer the following answer to get more information on the alternative solution https://www.mathworks.com/matlabcentral/answers/1636045-how-to-create-a-resizable-table-based-on-user-input-using-matlab-app-designer
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!