Showing a table in msgbox

15 ビュー (過去 30 日間)
Sine  Palm
Sine Palm 2015 年 11 月 20 日
コメント済み: Star Strider 2015 年 11 月 20 日
Hey.
I have given a table with students and their grades. I have to sort them and then display the table again. How can I display the table in a message box? Or in some other kind of popup window

回答 (1 件)

Star Strider
Star Strider 2015 年 11 月 20 日
I would use listdlg:
r = double('AZ'); % Create Data
names = char(randi(r, 10,5));
grades = randi([70 99], 10,1);
the_list = {cat(2, names, repmat(' ', 10, 1), num2str(grades))}; % Create Data
[student_nr, sel] = listdlg('PromptString','Class Results','ListString',the_list);
This allows you to select a particular student, or not, as you wish.
  2 件のコメント
Sine  Palm
Sine Palm 2015 年 11 月 20 日
編集済み: Sine Palm 2015 年 11 月 20 日
I don't want to select a particular student.I just want to show the table in a box instead of in the command window? Sorry if my question was confusing...
Star Strider
Star Strider 2015 年 11 月 20 日
You don’t have to do anything with the listdlg, although it gives you that option. It’s just the easiest way to display a list that I’m aware of.

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

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by