The for loop should take the name from the pictures and put them into an excel file. Excel writes the names from left to right but it should write the names from top to down.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
imageFolderPath = 'C...';
imageNames = {};
imageFiles = dir(fullfile(imageFolderPath, '*.jpg'));
% Schleife zum Lesen der Bilder nacheinander
for i = 1:length(imageFiles)
% Vollständiger Pfad zur aktuellen Bilddatei
currentImagePath = fullfile(imageFolderPath, imageFiles(i).name);
% Lese das Bild
OwnIm = imread(currentImagePath);
OwnImRe = imresize(OwnIm,imageSize(:,1:2));
% Zum Anzeigen des Bildes (optional)
imshow(OwnIm);
% Warte auf eine Tasteneingabe, bevor das nächste Bild geladen wird
pause;
% Füge den Bildnamen zur Liste hinzu
imageNames{end +1} = imageFiles(i).name;
end
T = table(imageNames)
%Pfad zur Excel - Datei
excelFilePath = 'C...';
filename = 'Test.xlsx';
writetable(T,filename, 'Sheet', 1,'Range','A1')
0 comentarios
Respuestas (1)
Harald
el 14 de Sept. de 2023
Hi,
the problem likely is that the table contains a row vector of image names.
If you transpose imageNames before creating a table, it should work:
imageNames = imageNames';
T = table(imageNames)
A (preferable) alternative would be to preallocate imageNames as a column vector ahead of the loop:
imageNames = cell(length(imageFiles), 1);
Best wishes,
Harald
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!