Matlab won't run code but prints it to command window - no error message, status bar: continue entering statement
이전 댓글 표시
Every time I try to run the following code, Matlab only prints it to the command window and does not run it. The status bar displays "continue entering statement".
The array allocation has the values -1; 0 or 1. taa_portfolio_returns is an array of zeros and Stocks and Bonds include returns. All arrays have the same size (1271x1).
I don't understand the issue with this loop, i tried restarting Matlab and restarting my computer, but it still appears.
for m=1:size(allocation,1)
if allocation(m,1)==1
taa_portfolio_returns(m,1)=0.7*Stocks(m,1)+0.3*Bonds(m,1)
elseif allocation(m,1)==-1
taa_portfolio_returns(m,1)=0.3*Stocks(m,1)+0.7*Bonds(m,1)
end
end
Any help is highly appreciated!!
댓글 수: 2
Walter Roberson
2021년 3월 15일
That code is not a problem, but some surrounding code might be a problem.
Note by the way that you do not assign to taa_portfolio_returns(m,1) if allocation is anything other than 1 or -1 . That would not cause it to ask to continue entering statement though.
CharlyZoe24
2021년 3월 15일
답변 (0개)
카테고리
도움말 센터 및 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!