Unable to perform assignment because dot indexing is not supported for variables of this type

2 次查看(过去 30 天)
I can't solve my error.what should I do for running my code?
%% Load Data
data=xlsread('location','sheet'); %%measured values(decimal number)
Targets=data(1:203,7);
Inputs=data(1:203,1:6);
%%getting error here
data.Inputs=Inputs;
data.Targets=Targets;
Targets=Targets(:,1);
%%Unable to perform assignment because dot indexing is not supported for variables of this type.

回答(2 个)

VBBV
VBBV 2022-12-28
d.Inputs=Inputs;
Targets=Targets(:,1);
d.Targets=Targets;
  1 个评论
VBBV
VBBV 2022-12-28
编辑:VBBV 2022-12-28
Use a different name other than data since it's a numeric array and not a structure. Only variables(fields) inside structures are accessed in that format

请先登录,再进行评论。


Star Strider
Star Strider 2022-12-28
The xlsread function returns the first output as a matrix of double values, as described in the documentation section on num, and not a structure.
Refer to ‘Inputs’ and ‘Targets’ as separate matrices, not fields of a structure (that does not exist).

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by