Borrar filtros
Borrar filtros

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

12 visualizaciones (últimos 30 días)
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

Respuestas (1)

Prasanna Konyala
Prasanna Konyala el 1 de Abr. de 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.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by