How to calculate data input by user in uitable and return in the same uitable
2 views (last 30 days)
Show older comments
Hi.
I have created a uitable in GUI, 10rows x 3 columns (col A, col B, col C). col A is editable, and user needs to input integer in each row of col A. I want the calculated output to appear in col B & col C.
For example :
colA = A;
colB = A * 2;
colC = colA * colB;
How do I call the cell in each row/column of the same uitable? What is the type of data in uitable (String/Data)?
Please help! Many thanks.
Aiya.
0 Comments
Answers (1)
Image Analyst
on 27 May 2012
Just get the data property of the table
tableData = get(handleToTable, 'Data');
tableData will be a cell array with whatever was in the table. Since it's a cell array, the data class can vary. You can specify the class when you set up the table, or let MATLAB decide dynamically as the user types stuff in. To get a cell array that is one column of the entire cell array, just index as usual
columnA = tableData(:, 1);
11 Comments
monu
on 27 Apr 2014
but my code related to selecting column from the uitable doesn't run ......what to do ???????/
Image Analyst
on 27 Apr 2014
How should we know? You just tacked this on to someone else's discussion that was 2 years old and didn't even give your code. How do you expect us to possibly say anything useful to you considering what you've told us??
See Also
Categories
Find more on Dialog Boxes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!