assign variable output to a column in GUI table

5 views (last 30 days)
How can I assign the values stored in a variable (x) to a column of a table in GUI. please help
  1 Comment
Geoff Hayes
Geoff Hayes on 16 Apr 2018
amna - are you creating your GUI with GUIDE, App Designer, or programmatically? Please clarify.
If using GUIDE, then you could do something like the following (I'm assuming that you have some sort of callback that performs an action that results in you wanting to update your table)
tableData = get(handles.uitable1, 'Data');
tableData(:,2) = x;
set(handles.uitable1, 'Data', tableData);
The assumptions are that your UI table is named uitable1 and that the number of rows in x is identical to the number of rows in the table (if not, then you can specify which rows of a certain column in the table you need to replace). For the purposes of this example, I'm replacing all of column 2 with x.

Sign in to comment.

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!