Popupmenu in the uitable

I have a popupmenu in the uitable: set(handles.uitable1, 'ColumnFormat', {{'A' 'R'}) And I want to do, if I choose 'A', than do something, for example, 2+2, else 2-2. How to format function, that it does, what I want?

 채택된 답변

Oleg Komarov
Oleg Komarov 2011년 3월 4일

0 개 추천

You should use CellEditCallback:
set(handles.uitable1, 'ColumnFormat', {'A' 'R'},'CellEditCallback',@myFun)
function myfun(varargin)
% Check for the value
% Do stuff
end
Oleg

댓글 수: 5

Walter Roberson
Walter Roberson 2011년 3월 5일
And make sure the column is marked as Editable, or else you will not be able to select the pop-up menu.
Eggo Ogge
Eggo Ogge 2011년 3월 5일
Yes, I know it. How to check value of the cell, data(1,1), for example?
Walter Roberson
Walter Roberson 2011년 3월 5일
get( subsref( get(handles.uitable1,'Data'), struct('type', '{}', 'subs', 1), 'Value' )
or more clearly:
d = get(handles.uitable1,'Data');
get(d{1,1},'Value')
Eggo Ogge
Eggo Ogge 2011년 3월 7일
It sends me the error.
Maybe it is another structure, I don't need that he shows, what the letter is: 'A' or 'R', but I need, that if it is the letter 'A', will do one action, else, another action.
Oleg Komarov
Oleg Komarov 2011년 3월 9일
There's is not such a thing as THE ERROR. Post the complete error msg you get.

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

추가 답변 (0개)

카테고리

도움말 센터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!

Translated by