How can write names of image / file in excel sheet using matlab ?
2 次查看(过去 30 天)
显示 更早的评论
I need to print name of an image or current browsed file in specific position in excel using matlab Here is the code of what I tried so far
Image2 = imread('D:\ahmed','jpeg');
xlswrite('D:\aa.xls',image2,'Sheet1','A1');
OR ..
when i need to print name of browse image in GUI .. how can i print name of this upload image in excel sheet ...
filename=handles.filename;
[X2] = imread(filename);
xlswrite('D:\aa.xls',[X2],'Sheet1','A1');
both codes don't write the name of image ... its give me name of variable (image2 or X2 ) and do not write name of image ahmed or name of image in X2 which i browsed ... any help please .
hope to get the following output :
excel sheet1 cell [A1] contain (( name of my image or browsed image name like wilyam or browsed image name ).
6 个评论
Image Analyst
2015-8-2
Did you even TRY my answer below? It works, even if the file already exists, and doesn't give any error.
采纳的回答
Image Analyst
2015-8-2
I think this should cover whatever case you want to do. It writes out both the filename string into cell A1, and the full uint8 numerical array into a bunch of cells with the upper left corner at cell A2 of the worksheet:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = 'D:\ahmed'; % Specify where starting folder is that the user starts browsing from..
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
% Read in the file into a variable called X2.
[X2] = imread(fullFileName);
imshow(X2, []);
drawnow;
% Construct the output workbook name.
excelFullFileName = fullfile(pwd, 'aa.xlsx');
% Now write out the filename string to cell A1 of a workbook called aa.xlsx.
% fullFileName needs to be put into a cell otherwise it will put one character
% of the filename into each cell along row 1 of the worksheet.
% To put into a cell, wrap the fullFileName variable in braces.
xlswrite(excelFullFileName, {fullFileName}, 'Sheet1', 'A1');
% Next write out the actual image array to cell A2 of a workbook called aa.xlsx.
% This takes a long time so be patient.
xlswrite(excelFullFileName, X2, 'Sheet1', 'A2');
% Launch Excel opened to this workbook.
winopen(excelFullFileName);
更多回答(3 个)
munah alhatmi
2016-3-27
please, could you help me in something similar....
I am working with image enhancement based soft computing using matlab...
I got the result of some filters and i had stored the result in excel file to be used later as input in neural network....
however, I need to save the result from neural stage and display again as image.
i mean how to store the result of xls file to jpg file.
i am looking for your help..
thanks in advance.
5 个评论
munah alhatmi
2016-3-28
i don't know why doesn't attached.i had selected the file!
can i send it by email?
I saved in excel file because i want to do training for data. I don't have an idea about other ways because i am beginner in using matlab.
Image Analyst
2016-3-28
After you click Choose File, and Open, you have to click Attach File.
You can use imwrite to save the image
imwrite(yourImage, 'temporary image.png');
You can make the filename whatever you want instead of 'temporary image.png'. To read it back in:
rgbImage = imread('temporary image.png');
munah alhatmi
2016-3-29
Dear Image Analyst,
i applied your method but the image appeared empty.
i feel the problem in passing the parameter.
i had attached my project.
my problem in second stage with MSE & PSNR and the resulted image.
i will appreciate your help.
many thanks,
0 个评论
munah alhatmi
2016-3-29
the attachment of second stage ( genetic algorithm using machine learning)
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing and Computer Vision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!