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

5 views (last 30 days)
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.

Answers (2)

VBBV
VBBV on 28 Dec 2022
d.Inputs=Inputs;
Targets=Targets(:,1);
d.Targets=Targets;
  1 Comment
VBBV
VBBV on 28 Dec 2022
Edited: VBBV on 28 Dec 2022
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

Sign in to comment.


Star Strider
Star Strider on 28 Dec 2022
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).

Community Treasure Hunt

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

Start Hunting!