Matlab won't run code but prints it to command window - no error message, status bar: continue entering statement
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 15 de Mzo. de 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
el 15 de Mzo. de 2021
Respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!