Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

Prasanna Konyala
Prasanna Konyala il 1 Apr 2022
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.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by