How to display selected row on table?

6 ビュー (過去 30 日間)
Bijit Banik
Bijit Banik 2011 年 7 月 9 日
Hello,
I was trying to make a program using guide to load data from excel or text file and then to display them on a table. Up to this it was fine but now I want to display some specific row on the table, which will be called from another button (say, search maximum). So, when I will click 'search maximum' button it will search maximum value and will bring the row having maximum value on the current window of the table. There might be thousands of data so I don't want to find my maximum value by scrooling down.
Does anyone can help me in doing that?
Thanks a billion..
Bijit

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 7 月 9 日
Let's say you have a 100x2 matrix, you want to search the maximum on first column and then display a few rows around the maximum to your uitable or a table in your GUI.
Matrix=[rand(100,1),(1:100)'];
[Dummy,Index]=max(Matrix(:,1));
StartIndex=max(1,Index-3);
EndIndex=min(100,Index+3);
Data=Matrix(StartIndex:EndIndex,:);
uitable('Data',Data);
  2 件のコメント
Bijit Banik
Bijit Banik 2011 年 7 月 9 日
Thanks Jiang for your reply. But I don't want to lose any data. All those 100 data will be on the table but the part of having maximum value will appear on current window. I can get other data just by scrolling the table. How can I do that?
Fangjun Jiang
Fangjun Jiang 2011 年 7 月 11 日
I see your point. If h=uitable('Data',(1:100)'), is there a way to control the vertical scroll bar programatically? I have not found a way. Anyone else chimes in?

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

カテゴリ

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