How insert a DropDownValue to Table in AppDesinger

2 vues (au cours des 30 derniers jours)
Torge Flatow
Torge Flatow le 25 Août 2022
Modifié(e) : Ankit le 29 Août 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?

Réponses (1)

Ankit
Ankit le 29 Août 2022
Modifié(e) : Ankit le 29 Août 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;

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by