Gui can't write in uitable

1 view (last 30 days)
Amjad Green
Amjad Green on 28 Apr 2018
Commented: Walter Roberson on 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

Answers (1)

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

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!