Error: Dot indexing is not supported for variables of this type when initializing an array

When trying to initialize an array I get the following error:
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in PhaseAmplitudeCouple (line 300) Comodulogram.R = zeros(length(PhaseFreqVector),length(AmpFreqVector)); here is the relevant code:
PhaseFreqVector = 0:1:50;
AmpFreqVector = 0:5:200;
Comodulogram.R = single(zeros(length(PhaseFreqVector),length(AmpFreqVector)));

댓글 수: 4

jonas
jonas 2018년 10월 10일
편집: jonas 2018년 10월 10일
Worked for me, you probably have a non-struct variable called Comodulogram already in your workspace.
Currently I have a cell named Comodulogram. I was gifted this code, but I believe Comodulogram.R is supposed to create a struct within the cell?
jonas
jonas 2018년 10월 10일
편집: jonas 2018년 10월 10일
That's not how it works. If the name is empty, then yes, you will create a structure with a field R. If the name is already taken, then matlab will try to create a field to said variable. The problem is that the variable is a cell and cells have no field names, which explains your error message.
You cannot have a variable Comodulogram that is both a cell and a structure, they are different classes.
I am getting the same error. I am trying to learn character recognition so I have found this code online and trying to run it but getting the error in the line axes(handles.axes6). can you help?
%% reading the image from the user
[filename, pathname] = ...
uigetfile({'*.jpg';'*.jpeg';'*.png';'*.*'},'Select Image File');
I=strcat(pathname,filename);
% figure(1);
%imshow(I);
axes(handles.axes6);% <----getting error here
imshow(I);
set(handles.pushbutton13,'Enable','on')
helpdlg('Image has been Loaded Successfully. Choose an algorithm and train the network ',...
'Load Image');

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

답변 (2개)

As described in the comments, this produces the same error:
A = {} ; % cell
A{1}.x = 1:10 % -> error!
% Unable to perform assignment because dot indexing is not supported for variables of this type.
The overcome this functionally, you can either delete the variable using clear, or overwrite the contents of the variable using the struct function, as in:
A = {}
A = struct('r',1:10) % overwrite

댓글 수: 2

Is there any ways to overwrite the contents in pointCloud inorder to meet the requirements for seeting up image?
error: Dot indexing is not supported for variables of this type.
Error in (line 164)
image = ptcloud.Location;
Error in (line 120)
I = helperPointCloudToImage(Location);
EDIT: Copyright code removed.
@kevin harianto: please do not post copyright code on this forum.

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

I also get " dot indexing is not supported for this type of variable" when i submit code for lrCostFunction in Ex 3 of week 4 of Machine learning by Andrew Ng, Stanford. Any Help will be useful and appreciated.

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2018년 10월 10일

댓글:

2022년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by