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 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Harald
2023 年 9 月 14 日
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
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!