Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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 ??

Akzeptierte Antwort

KSSV
KSSV am 21 Nov. 2016
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.

Weitere Antworten (0)

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by