Filter löschen
Filter löschen

Gui can't write in uitable

2 Ansichten (letzte 30 Tage)
Amjad Green
Amjad Green am 28 Apr. 2018
Kommentiert: Walter Roberson am 28 Apr. 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

Antworten (1)

Walter Roberson
Walter Roberson am 28 Apr. 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 Kommentare
Amjad Green
Amjad Green am 28 Apr. 2018
the user will input the data
Walter Roberson
Walter Roberson am 28 Apr. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by