Dot Indexing is not supported for variables of this type

1 次查看(过去 30 天)
I'm getting an error from the below code. It is showing me "Dot indexing is not supported for variables of this type"
data = load('Labels.mat');
S = dir(fullfile('C:\Users\surya\OneDrive\Desktop\Project Work\Target detection and recognition in underwater turbid areas using machine learning\Code\Enchanced Data\*.jpg'));
Extract_name = extractfield(S,'name');
Extract_name = Extract_name';
Extract_folder = extractfield(S,'folder');
Extract_folder = Extract_folder';
merge_cell = fullfile(Extract_folder,Extract_name);
merge_cell_table = cell2table(merge_cell);
data_goods = data.gTruth.ROILabelData.imageSequence_EnchancedData.gTruth;
data_goods = cell2table(data_goods);
trainingData = [merge_cell_table,data_goods];
shuffledIdx = randperm(height(trainingData));
trainingData = trainingData(shuffledIdx,:);
imds = imageDatastore(trainingData.merge_cell);
blds = boxLabelDatastore(trainingData(:,2:end));
ds = combine(imds, blds);
load('Yolov2_lgraph.mat');
lgraph = Yolov2_lgraph.lgraph;
% analyzeNetwork(lgraph);
lgraph.Layers;
options = trainingOptions('sgdm',...
'InitialLearnRate',0.001,...
'Verbose',true,...
'MiniBatchSize',16,...
'MaxEpochs',100,...
'Shuffle','never',...
'VerboseFrequency',30,...
'CheckpointPath',tempdir);
The Error I'm getting is:
Dot indexing is not supported for variables of this type.
data_goods = data.gTruth.ROILabelData.imageSequence_EnchancedData.gTruth;
  3 个评论
Walter Roberson
Walter Roberson 2024-1-10
In order to test we would need Labels.mat, Yolov2_lgraph.mat, and C:\Users\surya\OneDrive\Desktop\Project Work\Target detection and recognition in underwater turbid areas using machine learning\Code\Enchanced Data\*.jpg
We need to test because you did not post a full error message showing which line is generating the error.
Matt J
Matt J 2024-1-10
The Error I'm getting is...Dot indexing is not supported for variables of this type.
It should be easy for you to trap it with dbstop and see which variable is not the expected type.

请先登录,再进行评论。

回答(1 个)

Binaya
Binaya 2024-1-11
编辑:Binaya 2024-1-17
Hi SuryaTeja
Based on the description of the error, I understand that you are getting the error:"dot indexing is not supported for variables of this type". This error is found when you are trying to access the fields of an object which does not have any methods or properties.
To find the source of this error and to resolve this,
  1. You can open the "data" and "Yolov2_lgraph" objects in the workspace.
  2. For "data" object: open value in "gTruth", followed by "ROILabelData", followed by "imageSequence_EnchancedData".
  3. Check if "imageSequence_EnchancedData" has any structure or class stored as its value.
  4. If the value stored here is not a structure or class, MATLAB shows the error that this variable does not support dot indexing.
I hope this helps
Regards
Binaya

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by