How to store all feature extracted data of images into single excel sheet
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sukhesh chukkapalli
le 20 Mai 2016
Commenté : Anjali Acharya
le 22 Août 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 commentaires
Réponse acceptée
Image Analyst
le 20 Mai 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 commentaires
Image Analyst
le 21 Mai 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
le 22 Août 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
Plus de réponses (2)
Rangan M K
le 20 Mai 2016
Modifié(e) : Rangan M K
le 20 Mai 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 commentaires
sukhesh chukkapalli
le 20 Mai 2016
Modifié(e) : sukhesh chukkapalli
le 20 Mai 2016
Image Analyst
le 20 Mai 2016
#1 is not true for R2015b and later. They changed the way xlswrite() works.
kaavyaa stalin
le 21 Jan 2018
Modifié(e) : Image Analyst
le 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 commentaire
Image Analyst
le 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).
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!