필터 지우기
필터 지우기

how select columName in Table in the app designer

조회 수: 20 (최근 30일)
Luca Re
Luca Re 2023년 12월 2일
댓글: Luca Re 2023년 12월 18일
if i touch circle red
function UITableSelectionChanged(app, event)
selection = app.UITable.Selection;
T=CaricaListaStrategie_Aggreg_Struct(app.predator_Equity," ",selection);
end
selection =
1 5
if i touch circle green
selection =
1 5
2 5
3 5
4 5
5 5
6 5
7 5
8 5
9 5
How do I select only the column when you press on the green circle? (column name) (I would like to receive only "5" instead of having the whole array..
I know you could only consider the column in the array but I don't know if that's the correct procedure
I need this to sort the columns in descending order depending on which ColumnName I press

채택된 답변

Avni Agrawal
Avni Agrawal 2023년 12월 15일
Hi Luca,
I understand that you want to get the column name of a table when a cell is clicked. In MATLAB App Designer, it can be done by using the ‘CellSelectionCallback’ property of the ‘uitable’ component. This callback function is triggered when the user selects a cell in the table, and it provides information about the selected cell, including the row and column indices.
Here is an example of how to set up the ‘CellSelectionCallback’ and retrieve the column name:
% Cell selection callback: UITable
function UITableCellSelection(app, event)
indices = event.Indices;
if ~isempty(indices)
% Get the row and column index
row = indices(1, 1);
col = indices(1, 2);
% Get the column name using the column index
columnName = app.UITable.ColumnName{col};
disp(indices)
% Display the column index and name
disp(['selected cell in column: ', col, ":" , columnName]);
end
end
I hope this helps.
  댓글 수: 3
Avni Agrawal
Avni Agrawal 2023년 12월 18일
Hi, yes the above code will work for fetching the column name as well. Are you still facing any problem?
Luca Re
Luca Re 2023년 12월 18일
👍👍

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile 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!

Translated by