Prev: Looking for a Mex-file approach to speed up the computation of a partial-FFT algorithm
Next: How to set the 'Box' and the 'Grid' to different width?
From: Sayanatn on 28 Mar 2010 03:00 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 28 Mar 2010 04:27 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 28 Mar 2010 08:54
"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 |