How insert a DropDownValue to Table in AppDesinger

2 visualizzazioni (ultimi 30 giorni)
Torge Flatow
Torge Flatow il 25 Ago 2022
Modificato: Ankit il 29 Ago 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?

Risposte (1)

Ankit
Ankit il 29 Ago 2022
Modificato: Ankit il 29 Ago 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;

Categorie

Scopri di più su Tables in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by