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개)

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 CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by