error in double to struct not possible??

3 views (last 30 days)
preeti
preeti on 19 Aug 2015
Commented: Guillaume on 19 Aug 2015
function img=read_query(filename)
I=imread(filename);
[c1,c2,e1,h,v,e2]=glcm_feature_extraction(I)
xlswrite('qfile.xlsx',[c1,c2,e1,h,v,e2]);
c1,c2,...... are floating point numbers.....
error using ==>horzcat
following error has occured converting from double to struct...conversion of double to struct is not possible.
thanks in adv

Answers (1)

Walter Roberson
Walter Roberson on 19 Aug 2015
Mathworks does not supply any routine named glcm_feature_extraction(), and there is no routine by that name in the File Exchange, so we have no idea what your outputs are.
Your code can only work in the form it is now if all of the outputs c1, c2, e1, h, v, e2 are either strings or numeric arrays that have the same number of rows for every entry. The error message is consistent with at least one of the items instead being a structure of some kind. You need to examine
class(c1), class(c2), class(e1), class(h), class(v), class(e2)
I speculate that either h or v is the structure.
  1 Comment
preeti
preeti on 19 Aug 2015
function [Contrast,cor,ener,homo,V,E]=glcm_feature_extraction(I1)
Contrast1 = graycoprops(graycomatrix(rgb2gray(I1)),'Contrast')
cor1= graycoprops(graycomatrix(rgb2gray(I1)), 'Correlation')
ener1 = graycoprops(graycomatrix(rgb2gray(I1)), 'Energy')
homo1 = graycoprops(graycomatrix(rgb2gray(I1)), 'Homogeneity')
img = double(I1);
V1 = var((img(:)))
E1=entropy(I1)
Contrast = round(Contrast1* 1e1) / 1e1
cor= round(cor1* 1e1) / 1e1
ener=round(ener1* 1e1) / 1e1
homo=round(homo1* 1e1) / 1e1
V=round(V1* 1e1) / 1e1
E=round(E1* 1e1) / 1e1

Sign in to comment.

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!