Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi guys ,
how would i programaticaly select cell , e.g: highlite row1 col1 in a uitable in matlab ?

What I have tried:

i have tried some codes but they didnt worked
Posted
Updated 8-Sep-20 20:55pm

1 solution

A similar discussion with accepted solution:
Programatically selecting cells in a uitable - MATLAB Answers - MATLAB Central[^]
How to select/highlight a cell/row in the uitable programmatically? - MATLAB Answers - MATLAB Central[^]
% m = numeric handle to uitable
m = uitable(...); 
jUIScrollPane = findjobj(m);
jUITable = jUIScrollPane.getViewport.getView;
jUITable.changeSelection(row-1,col-1, false, false);
% subtract 1 from row and col you want selected
% the last two arguments do the following:
% false, false: Clear the previous selection and ensure the
%  new cell is selected.
% false, true: Extend the previous selection (select a range of cells).
% true, false: Toggle selection
% true, true: Apply the selection state of the anchor to all cells
%  between it and the specified cell.
 
Share this answer
 
v2
Comments
maria99 9-Sep-20 2:59am    
i have tried them but they didnt work .
Sandeep Mewara 9-Sep-20 3:11am    
In that case, For speedy response, would suggest to post in Matlab forum for more specific case of yours since above resolved solutions are not working for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900