How can write names of image / file in excel sheet using matlab ?
조회 수: 4 (최근 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!