problem during running my "while" loop?

1 回表示 (過去 30 日間)
Dhines
Dhines 2013 年 3 月 5 日
i maintained one algorithm for my project. in that some of steps are repeated until get some condition satisfied. so i use while for this steps. when i constructs the while loop for my algorithm. its works well, but its gives less value. that is i wrote coding for 50 features. but its gives upto 39 values. and shows some error. please kindly release this error and get sufficient output.
my code is...
while ~isempty(S)
X50=X0(:,S);
alpha=svmtrain(X50,Y1);
W=(((alpha.Alpha).*(alpha.GroupNames(alpha.SupportVectorIndices))))'* (alpha.SupportVectors);
m_f=alpha.SupportVectors;
tm_f= mean(m_f(1:4,:))-mean(m_f(5:7,:));
for i=1:length(W)
C(i)=W(i)*tm_f(i);
end
f=argmin(C);
r=[S(f),r];
S=S([1:f-1, f+1:length(S)]);
end
....
here my weight vector W values is 50 features.and also S. but both are shows only 39 values. what is the reason for that. i know this information not sufficient for you. because its my mid section of coding. if you want to any further information please ask.
  2 件のコメント
Jan
Jan 2013 年 3 月 5 日
Please post the error message instead of only mentioning, that it shows "some" errors. Actually Matlab cannot show some errors, because it stops after the first one. What does "showing values" exactly mean? Does the vector have 39 elements or are the remaining elements equal to zero?

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

回答 (2 件)

George Papazafeiropoulos
George Papazafeiropoulos 2013 年 3 月 5 日
How are X0 and Y1 defined?
George
  3 件のコメント
Jan
Jan 2013 年 3 月 7 日
@prasanna: Have you seen my questions in the comment section? Please answer them.
Dhines
Dhines 2013 年 3 月 8 日
??? Index exceeds matrix dimensions.
Error in ==> trained at 1329 r=[S(f),r];

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


Walter Roberson
Walter Roberson 2013 年 3 月 8 日

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by