How I can store all images name in an excel sheet?
Show older comments
My folder consisting of multiple binary images. I want to store their names in an excel sheet along with all their extracted features.
Answers (1)
Image Analyst
on 5 May 2018
Try this:
fileInfo = dir('*.PNG');
ca = struct2cell(fileInfo)
baseFileNames = ca(1,:)'
xlswrite(excelFullFileName, baseFileNames);
8 Comments
Zara Khan
on 5 May 2018
Image Analyst
on 5 May 2018
I have no idea what you did. The code I gave should execute. Do you want the full file names (path plus base filename plus extension)?
Zara Khan
on 5 May 2018
Image Analyst
on 5 May 2018
Try this:
fileInfo = dir('*.PNG');
% fullFileNames = cell(1, length(fileInfo)); % If you want it to go into one row of Excel.
fullFileNames = cell(length(fileInfo), 1); % If you want it to go into one column of Excel.
for k = 1 : length(fileInfo)
fullFileNames{k} = fullfile(fileInfo(k).folder, fileInfo(k).name);
end
% Write to Excel
xlswrite(excelFullFileName, fullFileNames);
Zara Khan
on 5 May 2018
Image Analyst
on 5 May 2018
That is not a folder of many binary images. You passed in one single image, data_set.png. Nonetheless, it should work as long as that one image is there. in the root folder of your D drive.
Zara Khan
on 5 May 2018
Zara Khan
on 6 May 2018
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!