필터 지우기
필터 지우기

Gui can't write in uitable

조회 수: 2 (최근 30일)
Amjad Green
Amjad Green 2018년 4월 28일
댓글: Walter Roberson 2018년 4월 28일
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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 4월 28일
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
Amjad Green
Amjad Green 2018년 4월 28일
the user will input the data
Walter Roberson
Walter Roberson 2018년 4월 28일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by