MATLAB: Data preparation for CNN

augmented image datastorecnnsplitlabelssubfolders

I have image folder with 10 subfolders. Each subfolder contain 180 images.
I need to call first 60 images in each subfolder and store it in XTrain1 variable; middle 60 images and store it in XTrain2 variable; last 60 Images and store it in XTrain3 variable.
Each variable (XTrain1, XTrain2, XTrain3) should be 4D double.
I tried the following code.
close all;clear;clc
imagefolder = 'C:\Users\manjurama\Desktop\study\PG\PROJECT\Finger vein database multiple copy\database_10';
imds = imageDatastore(imagefolder,'IncludeSubfolders',true,'LabelSource','foldernames');
numTrainFiles = 0.75;
imageSize = [227 227];
[XTrain,YTrain] = splitEachLabel(imds, numTrainFiles,'randomize');
XTrain = augmentedImageDatastore(imageSize,XTrain);
YTrain = augmentedImageDatastore(imageSize,YTrain);
Xtrain1 = XTrain.Files(1:60);
XTrain2 = XTrain.Files(61:120);
XTrain3 = XTrain.Files(121:160);
classes = categories(YTrain);% retrieve the class information with the type of categorical
numClasses = numel(classes);
Following error i got:
The value assigned to variable XTrain2 might be unused.
checking for missing argument or incorrect argument data type in call to funtion 'categories'.
Anybody help me to solve the issue or suggest any alternatives. Thanks in advance for your help.

Best Answer

That kind of datastore does not have any documented method of retrieving the associated category information.
(I am not at my desk so I do not know if there is an undocumented public method or a private property with the information.)