Effacer les filtres
Effacer les filtres

error in double to struct not possible??

1 vue (au cours des 30 derniers jours)
preeti
preeti le 19 Août 2015
Commenté : Guillaume le 19 Août 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
  1 commentaire
Guillaume
Guillaume le 19 Août 2015
See this related question for the root cause of the error.

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 19 Août 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 commentaire
preeti
preeti le 19 Août 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by