フィルターのクリア

Error in formation of matrix using variables computed in the code

1 回表示 (過去 30 日間)
Preeti Mistry
Preeti Mistry 2014 年 7 月 2 日
コメント済み: Geoff Hayes 2014 年 7 月 2 日
I want to form a row matrix "test" with the variables as shown below.
test = [Energy Correlation Contrast Homogeneity Entropy];
These variables are computed in my code and the code is running smoothly till calculation of the variables. However it is showing some error in forming the matrix "test".
This is the output that I am getting:
Energy =
Energy: 2.2724e-007
Correlation =
Correlation: 0.0172
Contrast =
Contrast: 1.4265e+006
Homogeneity =
Homogeneity: 0.0044
Entropy =
0.9959
??? Error using ==> horzcat The following error occurred converting from double to struct: Error using ==> struct Conversion to struct from double is not possible.
Error in ==> maculaedema at 171 test = [Energy Correlation Contrast Homogeneity Entropy];
>>
Can anyone help me in overcoming this error......
  1 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 7 月 2 日
How are you computing the variables? i.e. what is the code for each?
From the above output, it appears that Energy, Correlation, Contrast and Homogeneity are all structs with fields matching their names (for example Energy.Engery=2.2724e-007). Entropy, on the other hand, appears just to be a double.
I think that this mixture of structs and doubles is true given the error message that is telling you that the code cannot concatenate structs and doubles (the conversion to struct from double is not possible).
Either all variables should be structs, or all doubles. And I think it makes more sense to have all as doubles since there doesn't seem to be any advantage to having structs with a single field whose name is the same as the struct.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by