Dot Indexing is not supported for variables of this type

5 views (last 30 days)
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 Comments
Walter Roberson
Walter Roberson on 10 Jan 2024
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 on 10 Jan 2024
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.

Sign in to comment.

Answers (1)

Binaya
Binaya on 11 Jan 2024
Edited: Binaya on 17 Jan 2024
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

Community Treasure Hunt

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

Start Hunting!