Borrar filtros
Borrar filtros

Get selected element value from Table in MATLAB GUI

12 visualizaciones (últimos 30 días)
Shrinivas Hanchate
Shrinivas Hanchate el 24 de Nov. de 2020
Respondida: Rashed Mohammed el 27 de Nov. de 2020
Hi, I have added Table in MATLAB GUI, table contains the data readed from .xlsx file.
First of all, is this possible to select element in Table and get it's value ?
If this is possible then how can I get this selected element value?
I tried below steps in CellSelectionCallback function but I don't understand how can I get value from row and column value.
% --- Executes when selected cell(s) is changed in addressTable.
function addressTable_CellSelectionCallback(hObject, eventdata, handles)
% hObject handle to addressTable (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
% Indices: row and column indices of the cell(s) currently selecteds
% handles structure with handles and user data (see GUIDATA)
rows = eventdata.Indices(1,1);
columns = eventdata.Indices(1,2);
% logic for get element
I see lot of post related to this issue but it didn't work for us.
Will you please help me to solve this issue?
Please tell me the way how can I proceed further.
Thanks
Shrinivas

Respuestas (1)

Rashed Mohammed
Rashed Mohammed el 27 de Nov. de 2020
Hi Shrinivas
hObject in the CellSelectionCallback is a handle to the table. You can get the value of the selected cell using the 'Data' property of the hObject. In your case it would be
value = hObject.Data(rows,columns);
Hope this helps

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by