hello everyone

i have this code running and i want to save the every iteration in excel file but i had only managed to save only the last iteration value. i'm trying to get the P3 iterations for year (meain 8760 hours./ one iteration per hour )

how i can save the every iteration result in an excel file.

thank you very much.

`function [P3]=WT_output_power(WTno,HourTTF);%Topic: Stochastic model for wind turbine using Weibull distribution`

% Author: M.Farhan_Sarwar

% Date: September/2020

% WTno max condition is 2 and HourTTF max condition is 24

Vavg=14.6*(1000/3600); % average wind speed velocity m/s

sta=9.75*(1000/3600); % standard deviation of wind

Vci=9*(1000/3600); % the cut-in velocity m/s

Vr=38*(1000/3600); % the rated wind velocity m/s

Vco=80*(1000/3600); % the rated cut-off velocity m/s

P=[2500;2000]; % the max output power of WT1 and WT2 (KW)

k=2; % shape parameter

c=8.03; % scaling parameter

NC=8760;% finding the output power of wind turbine for 24 hr

for i=1:24;F(i)=c*(-log(rand(1)))^(1/k);% generate uniformly distributed random wind velocity

if F(i)<=Vci || F(i)>=Vco % || means or

P2(i)=0;endif F(i)>Vci && F(i)<VrP2(i)=P(WTno)*(F(i)^3-Vci^3)/(Vr^3-Vci^3); % the output power of WT

endif F(i)>VrP2(i)=P(WTno); %the output power of WT

end

`V(i)=i;endP3=P2(HourTTF)`

## Best Answer