Updating values on UITABLE
이전 댓글 표시
Can Someone please give me baby steps on how would I go on doing this?
here is my code
After input of new values on tables, nothing happens to the variable it staid as
0 0 0 0
0 0 0 0
prompt=('How many Elements?=');
elements=input(prompt);
prompt=('How many Nodes?=');
nodes=input(prompt);
Xi=zeros(nodes,1);
Yi=zeros(nodes,1);
Ux_BC=zeros(nodes,1);
Vy_BC=zeros(nodes,1);
clc
f = figure('Position', [100 100 752 350]);
t = uitable('Parent', f, 'Position', [25 25 700 200]);
nodeinfo=[Xi,Yi,Ux_BC,Vy_BC];
set(t, 'Data', nodeinfo);
set(t, 'ColumnName', {'Xi', 'Yi', 'Ux_BC', 'Vy_BC'});
set(t, 'ColumnEditable', [true true true true]);
set(t, 'ColumnFormat', {[] [] {'0' '1'} {'0' '1'}});
답변 (2개)
Image Analyst
2013년 9월 8일
0 개 추천
Well you're sending an array of all zeros, so I don't know why you expect anything other than all zeros. What do you think it should be? By chance do you want boolean/logical checkboxes instead of a 0 or 1 dropdown?
댓글 수: 3
raul
2013년 9월 8일
Image Analyst
2013년 9월 8일
I didn't see any code where you tried to send in new values, just the code where you initialized it with all zeros.
Are you using GUIDE? Just double click on the table to bring up the property inspector and tell it you want to look at that particular callback. Then put whatever code you want in there. That is only if you need to do something immediately as soon as they change something. Otherwise you can retrieve the whole table later, for example in a pushbutton callback, and do something with it there. If you're not using guide then you'll have to figure out how to add a callback with the uicontrol() function. Good luck.
Image Analyst
2013년 9월 8일
Does your callback actually get executed? When you set a breakpoint inside it, did it stop there?
댓글 수: 1
Jeremy
2013년 9월 8일
Your function needs to set nodeinfo = get(o,'data'). You're creating a new matrix called tableData. If you want your function to be generic enough to work for any uitable, you need to make it:
function tableData = cellupdate(o)
tableData = get(o,'data');
end
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!