Simple logical statement
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!