save in excel file inside a for loop

1 回表示 (過去 30 日間)
george veropoulos
george veropoulos 2017 年 1 月 21 日
コメント済み: george veropoulos 2017 年 1 月 21 日
hi i want to save the values of a vector in a xls file. The value s change inside a for loop... the variable is avg_rayleigh
clc
syms k s=sqrt(2/pi); m=2; w=4.527; S=1; sigma=1.42558; s_chi=0.42552; freq=[100:100:700]'
for i=100:100:700 freq=i; f=i*1e6;
[hm,P,er,k0,beta,er_eff,L]=parameter(f);
r=sqrt(er_eff)./er; theta=2*pi/5;
phi=3*pi/7; %phid=acosd(r.*sin(theta)) distr='Rayleigh' %coifficients [d1,d2]=coifp(k0,beta,L,er_eff,er,theta,phi);
d=d2;
if strcmp(distr,'Rayleigh') y=(sqrt(2/pi)*P*s*d)*1e3;
avg_rayleigh=[freq y]
%xlswrite('resultsmean.xls',avg_rayleigh,'sheet1','A1','B1') %xlswrite('out.xls',freq','sheet1','A1') %xlswrite('out.xls',avg_rayleigh(:,1),'sheet1','A1') %xlswrite('out.xls',avg_rayleigh(:,2),'sheet1','B1')
elseif strcmp(distr,'chi')
y=((15/8)*sqrt(2/pi)*s_chi*d*P)*1e3;
avg_chi=[freq y];
elseif strcmp(distr,'nakagami') y=((2/pi)*P*d*sqrt(w/m)*(gamma(m+1/2)/gamma(m)))*1e3;
avg_nakagami=[freq(i) y]
elseif strcmp(distr,'rician')
A=S/(sqrt(2)*sigma); I=(2*sqrt(2)/pi)*P*d*sigma*exp(-S^2/(2*sigma^2)); r=factorial(k); y=(I*vpa(symsum( A^(2*k)*gamma(k+3/2)/(r^2),0,inf),4))*1e3;
avg_rician=[freq y];
end end

採用された回答

Stalin Samuel
Stalin Samuel 2017 年 1 月 21 日
here you can see the Example code which has the solution
  1 件のコメント
george veropoulos
george veropoulos 2017 年 1 月 21 日
thank you.... i have use the num2str it is more simpel thna the printf.. but i cant find a similar example

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by