Error: Dot indexing is not supported for variables of this type when initializing an array
Mostrar comentarios más antiguos
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 comentarios
Zach Ip
el 10 de Oct. de 2018
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.
Anshuman Anshuman
el 24 de Nov. de 2020
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');
Respuestas (2)
Jos (10584)
el 10 de Oct. de 2018
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 comentarios
kevin harianto
el 6 de Abr. de 2022
Editada: Stephen23
el 6 de Abr. de 2022
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.
image = ptcloud.Location;
I = helperPointCloudToImage(Location);
EDIT: Copyright code removed.
Stephen23
el 6 de Abr. de 2022
@kevin harianto: please do not post copyright code on this forum.
Vijay Khanijow
el 4 de Mayo de 2021
0 votos
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.
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!