MATLAB Answers

get value in cell inside uitable by click on that cell

28 views (last 30 days)
muhammad zulhelmy
muhammad zulhelmy on 5 Mar 2017
Answered: MITAKSHI NIMJE on 19 Sep 2019
i read an excel and display at uitable2 using GUI MATLAB.
how can i get the value only for specific cell when i click into that cell in uitable2.


Jan on 5 Mar 2017
If you are in a hurry, provide enough information. What is "an uitable2"? What does "get the value" exactly means? Posting the required details is much more helpful than a bumping.

Sign in to comment.

Accepted Answer

Jan on 5 Mar 2017
Edited: Jan on 6 Mar 2017
I guess, that "uitable2" might be an uitable.
% [EDITED according to the comment, 06-Mar-2017 10:58 UTC]
function test
FigH = figure;
uitable('Data', rand(2, 3), ...
'CellSelectionCallback', @myCellSelectionCB);
handles.TextH = uicontrol('Style', 'Text', ...
'Position', [10, 300, 100, 28]);
guidata(FigH, handles);
function myCellSelectionCB(TableH, Event)
handles = guidata(TableH);
data = get(TableH, 'Data');
index = Even.Indices;
set(handles.TextH, sprintf('%g', data(index(1), index(2))));
Now the contents of the text field is set to the contents of the selected uitable element. If you provide more details about your existing code, it would be possible to post a better matching solution.


muhammad zulhelmy
muhammad zulhelmy on 6 Mar 2017
Actually uitable2 is tag for uitable in my GUI.
i want to click at any cell in uitable, get their value, then display it into editbox
can your coding do that ? is there any addition to your coding ??
here's are the picture
valerio raco
valerio raco on 26 Jan 2019
there is a typo.
Even.index should be Event.index.
otherwise, sweet answer. saved me tons

Sign in to comment.

More Answers (1)

MITAKSHI NIMJE on 19 Sep 2019
I have a .xls file. I want to process data row wise in matlab gui.Can somebody help me.
for eg-
parameters given are date, time, height,volume, etc.
if i want to display average of the given parameters from date-21/6/19 time 0.30 to 21/6/19 ,8.00.


Sign in to comment.


Translated by