How to put table in listdlg

6 ビュー (過去 30 日間)
Sean St Cyr
Sean St Cyr 2020 年 11 月 12 日
編集済み: Walter Roberson 2020 年 11 月 12 日
Hi I am trying to put the table "Information" into a list Dialouge box for a user to select and I keep getting errors. Can anyone help?
Information = readtable("Cooling Data.xlsx",'Sheet',"Information"); %Reads in the Information
%The reading of information was at the top of my code, I had cut out the other part of the code because it had no effect on the
%code i need help with
if strcmp(choice,'Detail')
selection = listdlg("PromptString",'Choose a material', "ListString",(Information))
mat = Information.Material(selection)
end
I keep getting these errors:
Error using cellstr (line 49)
Conversion to cellstr from table is not possible.
Error in listdlg (line 148)
liststring=cellstr(liststring);
  3 件のコメント
Sean St Cyr
Sean St Cyr 2020 年 11 月 12 日
It is an Excel file
Sean St Cyr
Sean St Cyr 2020 年 11 月 12 日

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 11 月 12 日
編集済み: Walter Roberson 2020 年 11 月 12 日
You cannot do that. listdlg requires a string array or a character vector or a cell vector of character vectors.
You can extract individual variables from the table and string() them to do some formatting but you are not going to be able to pass multiple columns in.
But you do not want to display the entire table.
selection = listdlg("PromptString",'Choose a material', "ListString", Information.Material )
  1 件のコメント
Sean St Cyr
Sean St Cyr 2020 年 11 月 12 日
I see, thank you for your help

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by