MATLAB: UItable CellSelectionCallback

cellselectioncallbackindicesuitable

How do I get the position of a call when I select it in a uitable? I know you can associate a CellSelectionCallback with a table, but what is the property to pull? A similar question two years ago said the proper field is Indices but this doesn't seem to work for me (Note, I am using R2008a). I would be expecting get(t,'Indices') to do the trick for me (t is the table), but such a field isn't recognized.

Best Answer

The CellSelectionCallback will be passed a minimum of two parameters, the first of which will be the uitable handle, and the second of which is the event data, which people commonly program to be received into the variable named "event". For CellSelectionCallback, event will be a structure which will have one field named "Indices" and it is that you want to look at.
For example,
function GasPricesTable_Selection_CB(src, event)
selected_cells = event.Indices;