Adding data to Matlab GUI Table from a listbox

17 views (last 30 days)
Jayesh Kavathe
Jayesh Kavathe on 26 Oct 2011
Commented: Nigussie on 13 Mar 2014
I have a Matlab table taking different type of input from user. Is there any way I can drag a single variable from a displayed listbox into the current active cell?
If not, can I "Add" a button to my interface, which when clicked, will populate the current cell with selected variable from the list box?

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 26 Oct 2011
It can be done as Amardeep suggested. But I think adding a push button is better as it avoids accidental operation when clicking on the table.
In the uitable CellSelectionCallback, you need to save the indices of the selected cell
In the push button callback, you need to read the list box and then assign the new value. The following code assumes the uitable contains cell data and all columns are editable.
Nigussie on 13 Mar 2014
I got the answer after some digging.

Sign in to comment.

More Answers (2)

Amardeep on 26 Oct 2011
under the cell selection callback for the GUI table you can get the value from the listbox using the handles structure for the listbox.

Jayesh Kavathe
Jayesh Kavathe on 26 Oct 2011
Perfect. I am a totally GUI newbie and still I was able to get it working. Appreciate for your time and exact code. :)
I am using the "Push" Button.


Community Treasure Hunt

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

Start Hunting!