how do I save the iterations of this loop in an array?
이전 댓글 표시
Hello,
I need to save each loop iteration in an array.
I tried everything I know, but obviouly thats not verry much.
here is my code:
x = 1000;
y = 1000;
fuellstand_o = zeros(1,1000);
fuellstand_oben = zeros(1,1000);
fuellstand_o(1) = 250000;
fuellstand_u = zeros(1,1000);
fuellstand_unten = zeros(1,1000);
fuellstand_u(1) = 150000;
fuellstand_risk = 50000;
kontostand = zeros(1,1000);
kontostand_1 = zeros(1,1000);
for k = 1:1000
if intraday_price(k) < 10 && fuellstand_u(k) > fuellstand_risk
fuellstand_o(k) = fuellstand_o + x;
fuellstand_u(k) = fuellstand_u - y;
kontostand(k) = kontostand(k) - intraday_price(k);
elseif intraday_price(k) > 40 && fuellstand_o(k) > fuellstand_risk
fuellstand_o(k) = fuellstand_o(k) - x;
fuellstand_u(k) = fuellstand_u(k) + y;
kontostand(k) = kontostand(k) + intraday_price(k);
end
if ((frequency(k) > 50) && (fuellstand_u(k) > fuellstand_risk) && (local_max(k) == 1))
fuellstand_o(k) = fuellstand_o(k) + x;
fuellstand_u(k) = fuellstand_u(k) - y;
kontostand(k) = kontostand(k) + 50;
end
if frequency(k) < 50 && fuellstand_o(k) > fuellstand_risk && local_min(k) == 1
fuellstand_o(k) = fuellstand_o(k) - x;
fuellstand_u(k) = fuellstand_u(k) + y;
kontostand(k) = kontostand(k) + 50;
end
end
fuellstand_oben(k) = fuellstand_o;
fuellstand_unten(k) = fuellstand_u;
kontostand_1(k) = kontostand;
I hope someone can help me...
댓글 수: 2
madhan ravi
2020년 7월 13일
편집: madhan ravi
2020년 7월 13일
Wir wissen nicht was die intraday_price Variable ist.
Martin Tambour
2020년 7월 13일
편집: Martin Tambour
2020년 7월 13일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!