Effacer les filtres
Effacer les filtres

Gui can't write in uitable

2 vues (au cours des 30 derniers jours)
Amjad Green
Amjad Green le 28 Avr 2018
Commenté : Walter Roberson le 28 Avr 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

Réponses (1)

Walter Roberson
Walter Roberson le 28 Avr 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 commentaires
Amjad Green
Amjad Green le 28 Avr 2018
the user will input the data
Walter Roberson
Walter Roberson le 28 Avr 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by