Multiple Selection in uitable

26 visualizaciones (últimos 30 días)
stefano squartini
stefano squartini el 22 de Nov. de 2020
Respondida: stefano squartini el 23 de Nov. de 2020
Hi, I have a row of characters in a uitable and I need to select multiple elements of it, store the indices of all selections and then apply subsequent actions: how to do that?
Thanks

Respuesta aceptada

Mario Malic
Mario Malic el 22 de Nov. de 2020
Hello,
If you want to select multiple elements in UITable, hold down the shift button. Add Cell Selection callback to the table, selected indices, you'll have in variable event.indices. Since I haven't used it before, you need to verify, if you get indices with every click or when the shift button is released.
% Callback function
function UITableValuesCellSelection(app, event)
indices = event.Indices; % indices is probably a numeric array (n,2) where n is number of selected cells
app.results = CalcFunction(app, indices); % results is the property of the app, CalcFunction is a helper function
end
function CalcFunction(app,indices)
% Access the table data through indices you sent to function
app.UITable.Data(indices(1,:))
% code
end

Más respuestas (1)

stefano squartini
stefano squartini el 23 de Nov. de 2020
Thank you, very useful.

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