How insert a DropDownValue to Table in AppDesinger

2 ビュー (過去 30 日間)
Torge Flatow
Torge Flatow 2022 年 8 月 25 日
編集済み: Ankit 2022 年 8 月 29 日
Hello,
I want to transfer a variable that I selected in a drop-down to a table.
This table is calling an ExcelTable to which I want to transfer the variable.
I get either
"Conversion to cell from char is not possible." when I use "app.t.Column1 = app.DropDown.Value" or
"Unable to perform assignment because the left and right sides have a different number of elements." when I use "app.t.Column1 = app.A" as an error message.
Does anyone have a solution?
  1 件のコメント
Torge Flatow
Torge Flatow 2022 年 8 月 29 日
The solutiuon was "cellstr()"

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

回答 (1 件)

Ankit
Ankit 2022 年 8 月 29 日
編集済み: Ankit 2022 年 8 月 29 日
can you let me know your output (app.DropDown.Value is a char or string). you need to convert to desired data type. You can't set data with double datatype with char/string
As I see you want to update the column name right?
here is one example:
fig = uifigure;
dd = uidropdown(fig,'Items',{'Red','Yellow','Blue','Green'},...
'Value','Blue');
cnames = {'Column1','Column2','Column3'}; % These are your column names
data = {'Male',52,true;'Male',40,true;'Female',25,false};
uit = uitable(fig,'Data',data,'ColumnName',cnames, ...
'Position',[140 140 262 204]);
uit.Data{1,1} = dd.Value;
uit.ColumnName{1,1} = dd.Value;

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by