How to store all feature extracted data of images into single excel sheet
1 view (last 30 days)
Show older comments
sukhesh chukkapalli
on 20 May 2016
Commented: Anjali Acharya
on 22 Aug 2018
In my project I have 250 images for character recognition. All images have Feature extracted data. But I need to store all images data into single excel sheet. I tried some code but it can over right on the previous data in the excel sheet. How can I store all data in single excel sheet.
Thank you
x=cell(1,267);
n=cell(1,267);
for j=1:250
x{j} = imread(sprintf('E:/apps/project/TELUGU data/telugu sep/1/ (%d).jpg',j))
n{j} = feature_extractor_2d(x{j});
xlswrite('text1.xls',n{j},1);
end
0 Comments
Accepted Answer
Image Analyst
on 20 May 2016
If you have R2015b or later, specify the sheet name and cell reference:
cellRef = sprintf('A%d', j); % Or wherever you want it.
xlswrite('text1.xls',n{j}, 'MyResults', cellRef);
If you have R2015a or earlier, use ActiveX so it won't be slow. See attached demo.
3 Comments
Image Analyst
on 21 May 2016
You can use R1:C1 notation instead, if you want, instead of A1. So to go into row 1, column j, do this:
cellRef = sprintf('R1:C%d', j);
xlswrite('text1.xls',n{j}, 'MyResults', cellRef);
Anjali Acharya
on 22 Aug 2018
This is my code, How can i save glcm features for multiple images in excel file. I am trying this code and i get features for last image only in excel file.
clear all; close all; clc;
%path D:\matlab\data\Training\glossy\*.jpg path='D:\matlab\data\Training\test\'; list=dir([path, '*.jpg']); for x=1:length(list) images{x}=imread([path, list(x).name]);
if length(size(images{x}))==3 %check if the image I is color
I=rgb2gray(images{x});
end;
%offsets0 = [0 1; -1 1; -1 0; -1 -1];
glcm1 = graycomatrix(I); stats{x} = graycoprops(glcm1,{'all'}); writetable(struct2table(stats{x}), 'test_glcmfeatures.csv') end
More Answers (2)
Rangan M K
on 20 May 2016
Edited: Rangan M K
on 20 May 2016
Hi Sukesh,
1. Using xlswrite in each for loop slows down the process, because each time you open and close excel sheet. Instead you can store all data into one cell and write at once in the excel sheet.
2. In case you are using your code, make sure you change page number after writing into excel sheet
xlswrite('text1.xls',n{j},Sheet(j));
if you want to continue in the same sheet, you may have to even mention the range each time you call xlswrite.
xlRange = 'E1';
xlswrite(filename,A,sheet,xlRange)
But note xlRange should keep changing in each for loop, so that you may have to write a small function which will give you an AlphaNumeric xlRange when you give row num and column number in each iteration.
Like ChangeToAlpha(2,2)=>'B2' -so when you give this range it will start adding the data from that cell
You can also use
xlRange = ['A',Linenum]; if you are always going to write from Row A
2 Comments
Image Analyst
on 20 May 2016
#1 is not true for R2015b and later. They changed the way xlswrite() works.
kaavyaa stalin
on 21 Jan 2018
Edited: Image Analyst
on 21 Jan 2018
In my project I have 50 images for quantity and price recognition. All images have feature extracted data. But I need to store all images' data into single Excel sheet. I tried some code but it can overwrite on the previous data in the excel sheet. How can I store all data in single excel sheet?
1 Comment
Image Analyst
on 21 Jan 2018
Use xlswrite(). Yes, it will overwrite any existing cells in the worksheet, and existing cells not in the same place will remain. It will always go onto a single sheet unless you specify arguments to write it to different sheet(s).
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!