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!