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
댓글 수: 0
채택된 답변
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
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
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
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
Image Analyst
2016년 5월 20일
#1 is not true for R2015b and later. They changed the way xlswrite() works.
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
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 Exchange에서 Spreadsheets에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!