필터 지우기
필터 지우기

How can I fit multiple column matrix in a matrix?

조회 수: 1 (최근 30일)
Jhilam Mukherjee
Jhilam Mukherjee 2015년 10월 20일
답변: Guillaume 2015년 10월 20일
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
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
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개)

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by