Values within a cell array must be numeric, logical, or char

조회 수: 5 (최근 30일)
shamal
shamal 2024년 1월 4일
댓글: shamal 2024년 1월 5일
hi, how can i solve it?
i've allegate "pl"
pl=struct2table(app.Preset);
vv=pl{:,1};
[~,vv,~]=fileparts(vv);
pl(:,1)={vv};
app.Preset_UITable.Data=table2cell(pl);
Error setting property 'Data' of class 'Table':
Values within a cell array must be numeric, logical, or char
  댓글 수: 2
Walter Roberson
Walter Roberson 2024년 1월 5일
Which MATLAB release are you using?
shamal
shamal 2024년 1월 5일
>> version
ans =
'9.14.0.2254940 (R2023a) Update 2'

댓글을 달려면 로그인하십시오.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 1월 5일
Which line is causing the issue?
In this example, all steps of converting struct - 2 - table and table - 2 - cell are working ok.
STR.V1 = "/home/jsmith/myfile.txt";
STR.V2 = 'C';
STR.V3 = 123;
STR.V4 = pi;
TAB = struct2table(STR)
TAB = 1×4 table
V1 V2 V3 V4 _________________________ __ ___ ______ "/home/jsmith/myfile.txt" C 123 3.1416
W=TAB{:,1};
[~,W,~] = fileparts(W);
TAB(1,1) = {W};
CELL_A = table2cell(TAB)
CELL_A = 1×4 cell array
{["myfile"]} {'C'} {[123]} {[3.1416]}
  댓글 수: 1
shamal
shamal 2024년 1월 5일
편집: shamal 2024년 1월 5일
app.Preset_UITable.Data=table2cell(pl); ===> here there is error

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by