why won't this code run?
7 ビュー (過去 30 日間)
古いコメントを表示
[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
採用された回答
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.
0 件のコメント
その他の回答 (1 件)
Walter Roberson
2017 年 11 月 23 日
You have
newt=[find(toremove(i)==c)],:)=[];
which attempts to do two assignments in one statement.
3 件のコメント
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.
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!