Simple logical statement
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi I have a question about logical statements.
I have a data set which includes some positive and some negative observations. I need to transform this data set is such a way that all observations that are positive become zero and those that are negative stay the same. What I have is the following:
SP_prices = xlsread('SP500_plusyear.xls', 'b2:b2780');
SP_returns = log(SP_prices(2:end)) - log(SP_prices(1:end-1));
SP_returns_extra = SP_returns(2527:end);
if (SP_returns_extra > 0)
{then SP_returns_extra = 0}
But this doesn't work, so I was wondering how I can change what I have to make it work. Thanks.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!