How can i store GLCM features of 100 images in a file at the running time of program?

조회 수: 2 (최근 30일)
In my project I have 100 images for brain tumor classification. All images have glcm Feature extracted data. But I need to store all images data into single excel sheet at the time feature get extracted. 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

답변 (1개)

Image Analyst
Image Analyst 2018년 3월 16일
In the loop, something like...
xlData = cell(numImage, 3);
for k = 1 : numImages
filename = .......
thisImage = imread(filename);
glcm = graycomatrix(thisImage);
stats = graycoprops(glcm,{'Contrast','Homogeneity'})
xlData{k, 1} = filename;
xlData{k, 2} = stats.Contrast;
xlData{k, 3} = stats.Homogeneity;
end
xlswrite(xlFileName, xlData);
Add more measurements to stats if you want.
  댓글 수: 2
ambily c
ambily c 2018년 3월 16일
But when i am use above code i met with an error.
The error shown in the command window is given below...
Undefined variable "featureset" or class "featureset.xls".
Error in newpro (line 99) xlswrite(featureset.xls,xlData);
how can i resolve this error
Image Analyst
Image Analyst 2018년 3월 16일
It needs to be a string, in single quotes:
xlswrite('featureset.xls',xlData);
or better yet
xlFileName = fullfile(pwd, 'featureset.xlsx')
xlswrite(xlFileName, xlData);

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by