Select cell from UITable by mouse click and using a push button to execute a callback
10 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'm trying to create an app where I open several images from a folder and have them listed into a UITable (image filenames in x row: 1 column). I have already created this table and what I would like to do is select an image file from this list and use a push button to run my image processing algorithm in the UIAxes that I have created. I'm having trouble on how to create this callback and would love to hear a solotion to my problem, thanks. I am using r2020a by the way.
0 件のコメント
採用された回答
Mario Malic
2020 年 10 月 15 日
Hi Raymond,
You need to create a CellSelection callback
Variable indices contains the index of selected row and column.
What might be a better way to process your image is to have the toggle button on/off, that will process your image if it's on, and do nothing if it's off.
% Cell selection callback: UITable
function UITableCellSelection(app, event)
indices = event.Indices;
if app.ToggleButton.Value
filepath = app.UITable.Data{indices(1),indices(2)} % Not sure if this is correct way
% of getting filepath, as it depends
% on type of data in the cell, so verify
processImage(app, filepath)
end
end
Otherwise, you could create a property that saves last selection and with the press of a button it would process file related to it.
% Cell selection callback: UITable
function UITableCellSelection(app, event)
app.Last_Selection = event.Indices;
end
% Button callback
ProcessImage(app) % Last_Selection is property of the app and doesn't need to be sent as an input arg
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!