
Re: xls file in matlab
Posted:
Jul 8, 2013 5:53 AM


On Monday, July 8, 2013 8:24:09 PM UTC+12, george veropoulos wrote: > Dear friend > > > > i run the following code in matlab > > > > > > spin=1/2; > > r_parallel=10; > > theta=0; > > n=1; > > l=0; > > yi=1; > > B=ones(size(10000)); > > Enl=ones(size(10000)); > > wave_function=ones(size(10000)); > > for i=0:5 > > B=i; > > [wave_function,Enl]=psi_parallel(r_parallel,theta,n,l,spin,yi,B); > > > > xlswrite('results.xlsx', B,'sheet1','A') > > xlswrite('results.xlsx',Enl,'sheet1','B') > > end > > > > > > the problem is that in xls(RESULTS) file i have ONLY one value > > for B=5 NOT ALL THE VALUES .(i=0,1,3,5 ) > > > > please help me > > thank you in advance
Yes, because you're printing it in A1 each time through the loop. But, first, what do you expect to get from this statement: B=ones(size(10000)); ? Try this: size(ones(size(10000))) Is that what you expected? why not: B=ones(1000,1); Then put your calculations inside the loop and write to Excel outside the loop.

