How to select/highlight a cell in the uitable automatically? Thank you.

5 ビュー (過去 30 日間)
Jonathan Wang
Jonathan Wang 2011 年 5 月 1 日
コメント済み: Maryam Abbaszadeh 2020 年 9 月 11 日
Hi,
I am working on part of my project, which the code update the output automatically if user chooses some cell in the uitable:
suppose we have a 2 rows * 1 column in the uitable like the following:
A
B
In my projects, A and B correspond to different outputs: they plot different curves in the same axis. What I want to do is that:
1, when user chooses A, we plot the curve A in the axes,
2, when user chooses B, we plot the curve B in the axes,
3, if user chooses both A and B, the code would plot the curve A in the axes, and update the uitable with only A selected, ie, we force to choose one cell at one time.
My question is that: in case 3, when users chooses both A and B, how can I update uitable to make only A chosen/hightlighted? I can re-set the uitable, but I don't know to make A to be chosen automatically after I re-set the uitable.
Thank you.
Jon

採用された回答

Andrew Newell
Andrew Newell 2011 年 5 月 2 日
  4 件のコメント
Rick
Rick 2013 年 3 月 7 日
it's a pity. Generating a callback cannot affect which cell is highlighted.
Maryam Abbaszadeh
Maryam Abbaszadeh 2020 年 9 月 11 日
Hi,
I have a simillar problem, I want to activate first cell of table([A 1])and show it A1 ina lable component. i tried above code but it didn't worked, how can I solve this problem ?
Thanks for your help.

サインインしてコメントする。

その他の回答 (1 件)

Teja Muppirala
Teja Muppirala 2011 年 5 月 2 日
For what you are trying to do, a listbox would be a more natural choice.
Here 'Max = 1' is saying that you can only select one at a time.
figure
uicontrol('style','listbox','String',{'A' 'B'},'Max',1,'units','n','position',[0 0 .1 1],'background','w')
  2 件のコメント
Teja Muppirala
Teja Muppirala 2011 年 5 月 2 日
And you CAN select listbox entries programatically.
Jonathan Wang
Jonathan Wang 2011 年 5 月 2 日
really thank you Teja. I actually have two uitables, each of which has multiple columns, so I gotta use uitables. I used A and B in my question to make it simple.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by