why won't this code run?

조회 수: 5 (최근 30일)
LM
LM 2017년 11월 23일
댓글: LM 2017년 11월 23일
[find(stock.permno)]==notrading(1);
for i=1:18522
end
for j=10137
newt=[find(toremove(i)==c)],:)=[];
end
for i=0:4
t((1+(i*126)):(126+(i*126)),:)=c((253+(i*378)):(379+(i*378)),:);
end
for i=1:5
trade(i).permno=top5(i,1);
for ii=0:4
trade(ii+1).price=d(1+(ii*252):252+(ii*252),4);
end
  댓글 수: 1
KSSV
KSSV 2017년 11월 23일
How did you run? What error you got?

댓글을 달려면 로그인하십시오.

채택된 답변

Bshara Murr
Bshara Murr 2017년 11월 23일
편집: Bshara Murr 2017년 11월 23일
Probably because you used the same local variable inside the main and nested loop. Try replacing the second i by a j (in every instance you are referring to it), and end your "for" loops.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2017년 11월 23일
You have
newt=[find(toremove(i)==c)],:)=[];
which attempts to do two assignments in one statement.
  댓글 수: 3
Walter Roberson
Walter Roberson 2017년 11월 23일
Possibly you want
newt(find(toremove(i)==c),:)=[];
but it is difficult to be sure as your code does not mention newt anywhere else.
LM
LM 2017년 11월 23일
got another error once i fixed it saying find has too many input arguments

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by