How insert a DropDownValue to Table in AppDesinger

2 Ansichten (letzte 30 Tage)
Torge Flatow
Torge Flatow am 25 Aug. 2022
Bearbeitet: Ankit am 29 Aug. 2022
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?

Antworten (1)

Ankit
Ankit am 29 Aug. 2022
Bearbeitet: Ankit am 29 Aug. 2022
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;

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by