2
votes

I have a uitable with 10 columns, which I'm populating from a db.

Now I want to know when the user choose a specific row. For example if the user chooses the 3rd record, I would like to get back the value 3, so then I could access the actual information to for example open that specific record from the path.

I found online that I would need findjobj. I also think that the method should be implemented in here:

function uitable_CellSelectionCallback(hObject, eventdata, handles)

However I found a little information about how I should proceed.

Anyone had this problem or knows how to solve it?

1
answering gui questions is always hard if there is no minimal example provided. Please post executable code we can work with. Also check out the matlab-uitable-tag. I contains dozens of answers which contain exactly what you need. Maybe not in the same context, but there surely will be examples. - Robert Seifert
an extensive starting point your can find here. - Robert Seifert
thank you for your reply! - Jurgen Cuschieri

1 Answers

3
votes

When calling the CellSelectionCallback you can access the Indices property, which is a 2 x 1 array containing the row and column indices of the cell you have selected.

Therefore in your callback, use something like this:

 row = eventdata.Indices(1)
 col = eventdata.Indices(2)

and that should get you going.