I have a following code and would also like to store all outputs that relate to "m". I was able to store all outputs of "i" but I'm struggling with storing those of every "m" value. Please help
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Maliseloane Morolong
le 17 Avr 2021
Réponse apportée : Mahesh Taparia
le 20 Avr 2021
clc; clear;
ValTraded_252_Days = zeros(10,252);
BrkgEarned_252_Days = zeros(10,252);
for j = 0.003:0.003:0.018
m = j;
for i = 1:252
day =i;
[ClientInfo,SharePrices,TradeSheet] = DailyTradeInfo(day,"MRLMAL001");
[ValTraded_252_Days(:,i), BrkgEarned_252_Days(:,i)] = ClientBRKGNew(ClientInfo, SharePrices, TradeSheet, m);
end
end
0 commentaires
Réponse acceptée
Mahesh Taparia
le 20 Avr 2021
Hi
You can store the information correspondig to each m value into a cell array. For example
clc; clear;
ValTraded = {};
BrkgEarned = {};
for j = 0.003:0.003:0.018
m = j;
ValTraded_252_Days = zeros(10,252);
BrkgEarned_252_Days = zeros(10,252);
for i = 1:252
day =i;
[ClientInfo,SharePrices,TradeSheet] = DailyTradeInfo(day,"MRLMAL001");
[ValTraded_252_Days(:,i), BrkgEarned_252_Days(:,i)] = ClientBRKGNew(ClientInfo, SharePrices, TradeSheet, m);
end
ValTraded = {ValTraded;ValTraded_252_Days};
BrkgEarned = {BrkgEarned;BrkgEarned_252_Days};
end
Here the information is stored in cell array where its elements stores the array for each value of m. Hope it will help!
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!