for i = 1:nclass,%1 inx_i = find(class== Numclass(i));%2 Xki = Vector(:,inx_i);%3 Dki = DW(:,inx_i);%4 sum(Dki); %5 M(i,:)=sum(Dki*Xki');%6 meanclass(i) = Numclass(i); %7end in this code meaning of 3rd n 4th line, n can we use ',' after for

2 次查看(过去 30 天)
for i = 1:nclass,%1
inx_i = find(class== Numclass(i));%2
Xki = Vector(:,inx_i);%3
Dki = DW(:,inx_i);%4
sum(Dki); %5
M(i,:)=sum(Dki*Xki');%6
meanclass(i) = Numclass(i); %7
end
in this code meaning of 3rd n 4th line, n can we use ',' after for loop? line number 6th means that every ith row of M will store sum of product of Dki and Xki ??

采纳的回答

KSSV
KSSV 2016-11-21
for i = 1:nclass,%1
inx_i = find(class== Numclass(i));%2
Xki = Vector(:,inx_i);%3 Extracting the column inx_i from matrix Vector
Dki = DW(:,inx_i); %4 Extracting the column inx_i from DW
sum(Dki); %5
M(i,:)=sum(Dki*Xki');%6 Dki*Xki' will be a matrix, sum(Dki*Xki') results into a array
meanclass(i) = Numclass(i); %7
end
% in this code meaning of 3rd n 4th line, n can we use ',' after for loop?
% line number 6th means that every ith row of M will store sum of product of Dki and Xki ??
I suggest you to run the code and use debugging option. When you put debugging point, your code will stop at the point and you can check the dimensions of every variable of the code. Read about debugging matlab code.

更多回答(0 个)

类别

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

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by