Matlab won't run code but prints it to command window - no error message, status bar: continue entering statement
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 15 Mar 2021
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
le 15 Mar 2021
Réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!