# How can i enter the outputs of this for loop into an array

1 vue (au cours des 30 derniers jours)
mos le 28 Avr 2021
Commenté : mos le 28 Avr 2021
poweroutputs = zeros(12,1);
for windspeedvar = [24.1 22.8 21.5 18.0 15.5 14.4 13.7 14.7 18.1 21.1 22.2 22.5];
[power2,speed2] = florisv2(windspeedvar,density,winddirection,turbinecentrekerrygold,yawangle,diameters,powercurve,location);
d = sum(power2)/1000000;
v = 1:12;
poweroutputs(v,1) = d
end
I'm a beginner in MATLAB, I need to know how to enter the outputs of the following for loop into an array so that the final output is a 12x1 matrix.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

David Fletcher le 28 Avr 2021
poweroutputs = zeros(12,1);
iterator=1;
for windspeedvar = [24.1 22.8 21.5 18.0 15.5 14.4 13.7 14.7 18.1 21.1 22.2 22.5];
[power2,speed2] = florisv2(windspeedvar,density,winddirection,turbinecentrekerrygold,yawangle,diameters,powercurve,location);
d = sum(power2)/1000000;
poweroutputs(iterator,1) = d
iterator=iterator+1;
end
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
mos le 28 Avr 2021
you're a lifesaver, thank you so much.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Data Type Conversion 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!

Translated by