From: Sayanatn on
I am opening a file and trying to print cpomples roots but only showing real parts on the file given

code below

here s is calculated above by a diferent program but my problem is to get real and imaginary on the file output named newresults.dat

fid = fopen('Newresults.dat','w');
s=[T0 T1 T2 T3];
r=roots(s);

r
fprintf(fid,'%15.12 f \n',r);
%%end
fclose(fid)

if roots are comples it showing zero but i want also the imag part on the file ,

2. how could i print separately on two colums the real and imaginary part?
From: Walter Roberson on
Sayanatn wrote:
> I am opening a file and trying to print cpomples roots but only showing
> real parts on the file given

You will have to write out real(r) and imag(r) separately. There is no
Matlab format specifier for complex numbers.
From: us on
"Sayanatn " <sayan.polo(a)gmail.com> wrote in message <homupl$auf$1(a)fred.mathworks.com>...
> I am opening a file and trying to print cpomples roots but only showing real parts on the file given
>
> code below
>
> here s is calculated above by a diferent program but my problem is to get real and imaginary on the file output named newresults.dat
>
> fid = fopen('Newresults.dat','w');
> s=[T0 T1 T2 T3];
> r=roots(s);
>
> r
> fprintf(fid,'%15.12 f \n',r);
> %%end
> fclose(fid)
>
> if roots are comples it showing zero but i want also the imag part on the file ,
>
> 2. how could i print separately on two colums the real and imaginary part?

this FEX submission should do what you want...

http://www.mathworks.com/matlabcentral/fileexchange/23840

us