フィルターのクリア

How can write names of image / file in excel sheet using matlab ?

4 ビュー (過去 30 日間)
ahmed obaid
ahmed obaid 2015 年 8 月 2 日
コメント済み: munah alhatmi 2016 年 3 月 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
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.
ahmed obaid
ahmed obaid 2015 年 8 月 2 日
yes i tried it , but its .. in this case when i browsed an image which its name differ each time
filename=handles.filename;
[X2] = imread(filename);
I3=rgb2gray(X2);
figure,imshow(I3)
xlswrite('D:\aa.xls',I3,'Sheet1','A1');
its does not write the name of this image .. how can write the name of this image please

サインインしてコメントする。

採用された回答

Image Analyst
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);
  8 件のコメント
ahmed obaid
ahmed obaid 2015 年 8 月 3 日
thank you a lot sir .. i solved my problem based on your help ... your codes help me more .. please accept my apologies for confuse with my best regards ..

サインインしてコメントする。

その他の回答 (3 件)

munah alhatmi
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
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
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
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,

munah alhatmi
munah alhatmi 2016 年 3 月 29 日
the attachment of second stage ( genetic algorithm using machine learning)
  2 件のコメント
ahmed obaid
ahmed obaid 2016 年 3 月 30 日
Dear friend
the better thing to do for your problem is to submit question on your question wall you will get many answers please do not use any question wall for your problem include me , this thing can be so efficient to got knowledge for all users , thanks to understand that
munah alhatmi
munah alhatmi 2016 年 3 月 30 日
Dear ahmed..
thank you for your advice.
sure, i will do it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by