error in double to struct not possible??

1 次查看(过去 30 天)
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

回答(1 个)

Walter Roberson
Walter Roberson 2015-8-19
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 个评论
preeti
preeti 2015-8-19
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by