How to assign values for uitable using a for loop?
显示 更早的评论
Hi
I'm new to matlab. Currently I'm working with GUI. So I developed a code to visible a table to gather user inputs. That uitable has 2 columns. Number of rows is a user defined value n. Column 1 must have predefined values and column 2 must gather user input data to an array. I want to assign values from 1 to n for column 1 of uitable. So I tried with a for loop. This is my code.
n = str2num(get(handles.N,'String')); % get number of stories from user
set(handles.table1,'visible','on')
ndata = cell(n,2);
set(handles.table1, 'data',ndata);
for i=1:1:n
set(handles.table1(i,1),'String',i);
Following error occurred.
The name 'String' is not an accessible property for an instance of class 'uitable'
Can anyone tell me what should be the modification here?
Thank You
1 个评论
Adam
2017-7-4
Did you read the help documentation for uitable? If not why not?, if so why are you trying to assign 'String' in a table? 'Data' is the property you should be setting.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!