Borrar filtros
Borrar filtros

How to store all feature extracted data of images into single excel sheet

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Image Analyst
Image Analyst el 20 de Mayo de 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 comentarios
Image Analyst
Image Analyst el 21 de Mayo de 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
Anjali Acharya el 22 de Ag. de 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

Iniciar sesión para comentar.

Más respuestas (2)

Rangan M K
Rangan M K el 20 de Mayo de 2016
Editada: Rangan M K el 20 de Mayo de 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 comentarios
sukhesh chukkapalli
sukhesh chukkapalli el 20 de Mayo de 2016
Editada: sukhesh chukkapalli el 20 de Mayo de 2016
Thanks for your answer, but I have one doubt. I am using this code now
x=cell(1,267);
n=cell(1,267);
xlRange = 'A1';
for j=1:250
x{j} = imread(sprintf('E:/apps/project/TELUGU data/telugu sep/%d/ (%d).jpg',i,j))
n{j} = feature_extractor_2d(x{j});
xlswrite('text4.xls',n{j},j,xlRange);
end
after using this code the excel sheet get error after 23 pages are created. The error is "Excel cannot access 'text4.xls'. The document may be read-only or encrypted."
Image Analyst
Image Analyst el 20 de Mayo de 2016
#1 is not true for R2015b and later. They changed the way xlswrite() works.

Iniciar sesión para comentar.


kaavyaa stalin
kaavyaa stalin el 21 de En. de 2018
Editada: Image Analyst el 21 de En. de 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 comentario
Image Analyst
Image Analyst el 21 de En. de 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).

Iniciar sesión para comentar.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by