Passing multiple Arrays to loop a Function and creating a 1 column array
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello! I have the following but I am not sure what i am missing:
A=ArrayA; (1,000x1) Double
C=ArrayC; (1,000x1) Double
V=ArrayV; (1,000x1) Double
sz = 1000
mmm = zeros(size(sz));
for i = 1:sz
sh(A,C,V) = Function(HistoricalValue,A,C,C,V,V);
mmm(i,:) = sh;
end
What i am trying to do is pass a list of values A,C,V thru my function so its evaluated unders those passing values and store the result in "mmm" thru a loop.
Would appreciate any help! Thanks!
0 Commenti
Risposte (2)
Jan
il 25 Dic 2021
The code contains some strange details:
A = ArrayA; (1,000x1) Double
Please use the standard notation. I assume this would be some matching test data:
A = rand(1000, 1);
sz = 1000;
mmm = zeros(size(sz));
sz is a scalar. Then size(sz) is [1,1]. I guess, that mm should not be a scalar. Maybe you want:
mm = zeros(sz, 1);
It would be useful to mention the size of the output of "Function".
I cannot imagine, why the inputs C and V are provided twice. Is this typo?
With some bold guessing:
mm = zeros(sz, 1);
for k = 1:sz
mmm(k) = Function(HistoricalValue, A(k), C(k), V(k));
end
Vedere anche
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!