For loop to multiple columns

1 visualizzazione (ultimi 30 giorni)
david crowley
david crowley il 27 Apr 2021
I have the following block of code:
%RSI Calculation
n = [14:2:18];
for i = 1:n
gainC = diff(ABC).*((diff(ABC))> 0);
lossC = -(diff(ABC)).*((diff(ABC)) < 0);
avg_gainC = movmean(gainC,[i-1 0],'omitnan');
avg_lossC = movmean(lossC,[i-1 0],'omitnan');
RS = (avg_gainC ./ avg_lossC);
ABC_RSI = 100 - (100 ./ (1+RS));
end
I need to know how I can create a table 'ABC_RSI' with the columns 14w_RSI, 16w_RSI, 18w_RSI and populated using the formula. Can someone please help?

Risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by