How can I fit multiple column matrix in a matrix?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to create a M*N matrix, whose each column contains one column matrix of different features namely T(i),T1(i),T2(i),T4(i),T5(i). While I want to assign all the column matrix the final matrix shows last row value rather than whole matrix. How can I get whole matrix
X_entropy=[0.0640;0.0658;0.0282;0.0286;0.1237;0.9477;0.0124;0.1100;0.8323;1.2819;0.9289;0.9040;0.7039;0.0103;];
myEdist_entropy = squeeze(sqrt(sum(bsxfun(@minus,X_entropy,reshape(X_entropy',1,size(X_entropy,2),size(X_entropy,1))).^2,2)));
x_entropy=sum(myEdist_entropy);
y_entropy=mean(x_entropy);
s=length(X_contrast);
for i=1:s
%a=
T(i)=X_contrast(i)*y_contrast;
T1(i)=X_correlation(i)*y_correlation;
T2(i)=X_energy(i)*y_energy;
T3(i)=X_homogeniety(i)*y_homogeniety;
T4(i)=X_standard_deviation(i)*y_standard_deviation;
T5(i)=X_entropy(i)*y_entropy;
M=[T(i) T1(i) T2(i) T3(i) T4(i) T5(i)]
end
Each X_feature contains same number of element
1 件のコメント
Harish kumar Kotapally
2015 年 10 月 20 日
Use cell command for suppose if A is required M*N matrix. code:
A=cell(1,N)
for i=1:1:M
A{1,i}=T{i};
end
A=cell2mat(A);
採用された回答
Guillaume
2015 年 10 月 20 日
Either, replace the assignment in the loop by an indexed assignment:
M(i, :) = [T(i) T1(i) T2(i) T3(i) T4(i) T5(i)]; %surely you can come up with better variable names than Tn.
Or simply do the concatenation after the loop:
M = [T T1 T2 T3 T4 T5];
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Feature Detection and Extraction についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!