how to fix this error "Dot indexing is not supported for variables of this type"

조회 수: 32 (최근 30일)
Waseem Abbas
Waseem Abbas 2022년 5월 24일
댓글: Voss 2022년 5월 24일
nuser = kernel_param.nuser;
nmovie = kernel_param.nmovie;
ndata = kernel_param.ndata;
this is my code and when i run this code, i get the following error,
""Dot indexing is not supported for variables of this type""
what does this error mean, and how to solve it, please
  댓글 수: 1
Allen
Allen 2022년 5월 24일
@Waseem Abbas you should also provide some details on your data set to the kernel_param variable or a sample set of that data.

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

답변 (1개)

Voss
Voss 2022년 5월 24일
편집: Voss 2022년 5월 24일
It means kernel_param is not a struct.
Here kernel_param is a struct, so it works fine:
kernel_param = struct('nuser',0,'nmovie',99)
kernel_param = struct with fields:
nuser: 0 nmovie: 99
nuser = kernel_param.nuser
nuser = 0
nmovie = kernel_param.nmovie
nmovie = 99
And here kernel_param is not a struct, so you get that error:
kernel_param = [1 2 3]
kernel_param = 1×3
1 2 3
nuser = kernel_param.nuser
Dot indexing is not supported for variables of this type.
How to solve it? Check where kernel_param comes from, and figure out why it's not a struct when it should be, or figure out why your code expects it to be a struct when it's not.
  댓글 수: 2
Waseem Abbas
Waseem Abbas 2022년 5월 24일
thanks for the answer, i have another file in which these kernel are struct, so i have to run that file before runing this file?
am i right?
Voss
Voss 2022년 5월 24일
Possibly. I have no way to know what that file does.

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

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by