Brace indexing is not supported for variables of this type.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Beatriz
am 26 Jan. 2023
Kommentiert: Beatriz
am 26 Jan. 2023
Hi I need some help. I have created this for loop to extract the images in the different subfolders that are in the given directory in order to process them in another script called Feat_extraction_k. The loop does fine for the first subfolder and the images inside. However, once it reaches the second subfolder the error is displayed for the line with the variable 'Image File' (Brace indexing is not supported for variables of this type) How can I fix this? Thanks.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 26 Jan. 2023
Try this:
filePattern = fullfile(pwd, '*.png');
imds = imageDatastore(filePattern)
allFileNames = imds.Files;
numFiles = numel(imds.Files);
for k = 1 : numel(allFileNames)
% Get this file name.
fullFileName = allFileNames{k};
fprintf('Processing %s\n', fullFileName);
end
You can set the top level folder in the first line of the code above by replacing pwd with some folder of your own.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!