Hi Jacky,
It is my understanding that you are new to MATLAB and trying to read text file using ‘importdata’ function. As per your ‘ctrain.txt’ file content your first column contains text data(file name and location) and when you are reading this file using ‘importdata’ function, CTrain object of type struct is created with three fields(data,textdata,rowheaders). Where your file name stored in rowheaders and textdata of CTrain object and you can access those values using dot notation.
The following solution fix issue in your code
CTrain = importdata('./database/AA/ctrain.txt');
CTrainNo = size(CTrain.textdata, 1);
for i = 1 : CTrainNo
ClTrain = imread(['./database/AA/Client/' CTrain.textdata{i}]);
imwrite(ClTrain, ['.\database\AA\train\bb\' num2str(i-1, '%05d') '.png']);
end
Please refer to the importdata, readtable documentation for more information on how to work with text file.
Hope this will help you.