Gui can't write in uitable

2 visualizaciones (últimos 30 días)
Amjad Green
Amjad Green el 28 de Abr. de 2018
Comentada: Walter Roberson el 28 de Abr. de 2018
t=uitable1('ColumnName',{'X','Y'}),
set(t,'ColumnEditable',true(1,2))
A=get(handles.uitable1,'Data');
x=A(:,1);y=A(:,2);
...
when i run it,it is not allowing me to enter data

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Abr. de 2018
What is uitable1 ?
You do not appear to have put any data into the uitable. uitable entries have to exist already to be editable. It is not possible for the user to create new entries in a uitable (but you can add a button that you program to extend the uitable.)
  2 comentarios
Amjad Green
Amjad Green el 28 de Abr. de 2018
the user will input the data
Walter Roberson
Walter Roberson el 28 de Abr. de 2018
How will the user input the data if you have not created any entries in the uitable yet?
You need to start out with something like
initial_data = zeros(5,2);
t = uitable('ColumnName',{'X','Y'}, 'data', initial_data, 'ColumnEditable', true(1,2));
This would create a 5 x 2 initial area to enter data into. However, unless you added more buttons to do the work, the user would not be able to expand that into more than the 5 rows.
uitables do not have any "add row" button built in. And when the user presses return on the last entry, the uitable does not automatically expand to hold more.
uitables should be viewed as a fixed-sized form, not as an automatically expanding form.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by