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

1 回表示 (過去 30 日間)
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

採用された回答

Image Analyst
Image Analyst 2016 年 5 月 20 日
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 件のコメント
Image Analyst
Image Analyst 2016 年 5 月 21 日
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 2018 年 8 月 22 日
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

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

その他の回答 (2 件)

Rangan M K
Rangan M K 2016 年 5 月 20 日
編集済み: Rangan M K 2016 年 5 月 20 日
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 件のコメント
sukhesh chukkapalli
sukhesh chukkapalli 2016 年 5 月 20 日
編集済み: sukhesh chukkapalli 2016 年 5 月 20 日
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 2016 年 5 月 20 日
#1 is not true for R2015b and later. They changed the way xlswrite() works.

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


kaavyaa stalin
kaavyaa stalin 2018 年 1 月 21 日
編集済み: Image Analyst 2018 年 1 月 21 日
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 件のコメント
Image Analyst
Image Analyst 2018 年 1 月 21 日
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).

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

カテゴリ

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