Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: xls file in matlab
Replies: 4   Last Post: Jul 15, 2013 5:07 AM

 Messages: [ Previous | Next ]
 Derek Goring Posts: 3,920 Registered: 12/7/04
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 )
>
>
>
>
> 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.

Date Subject Author
7/8/13 george veropoulos
7/8/13 Derek Goring
7/8/13 Steven Lord
7/15/13 george veropoulos
7/15/13 george veropoulos