help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fprintf bug?


From: frank wang
Subject: Re: fprintf bug?
Date: Wed, 9 Aug 2006 14:32:59 -0700

I just test it in another machine and found the code works. Then I found out the failure was caused by copy the code from vi editor.  If I copy the all code, then press the middle mouse to paste it into octave, it will not work as before. But if I copy the code without the last fclose(fid), then paste it into ocatve, hit return and type fclose(fid). It works.
 
Thanks
 
Frank

 
On 8/9/06, frank wang <address@hidden> wrote:
It does not work in my setting. I am using 2.9.7. I just run it and u=1. I got the last few lines:
 
u =  1

ii =  14
u =  1
ii =  15
u =  1
Badly placed ()'s.
 
And the output file is e(fid). All output correctly printed in this file e(fid).
 
I will try it in another machine.
 
Thanks
 
Frank

 
On 8/9/06, Dmitri A. Sergatskov <address@hidden > wrote:
On 8/9/06, Quentin Spencer < address@hidden> wrote:
> frank wang wrote:
> > Hi,
> > While using Octave, I noticed a problem with fprintf. It maybe a bug
> > and I need expert's opinion.
> >
> > Here is the code it does not work. It will print the output to a file
> > named e(fid); u is a complex number. In this example, it is u =
> > 0.0044312 +  0.0044312i
> >
> > fid = fopen('test_report.txt','w');
> > for (ii = 0:15)
> > ii
> > u
> >    fprintf(fid,'%d     %f\n', ii, u);
> > end
> > fclose(fid)
> >
> > If we add ; after u, then it will print the data to test_report.txt.
> > Here is the code:
> >
> > fid = fopen('test_report.txt','w');
> > for (ii = 0:15)
> > ii
> > u;
> >    fprintf(fid,'%d     %f\n', ii, u);
> > end
> > fclose(fid)
> >
> > Thanks
> >
> > frank
>
> You're saying you get what you expect in the second example, but not in
> the first? I tried both cases and got the same result in octave 2.9.7.

I see some bug with 2.9.7.
If I do not put ";" after u (in my case u = 1) I get this junk:
...
ii =  14
u =  1
ii =  15
u =  1
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `lessecho -p0x22 -d0x22 -e\\ -n0x3b -n0x20
-n0x2a -n0x3f -n0x9 -n0xa -n0x27 -n0x22 -n0x28 -n0x29 -n0x3c -n0x3e
-n0x5b -n0x5d -n0x7c -n0x26 -n0x5e -n0x60 -n0x23 -n0x5c -- e(fid)'
octave:4>

>
> Quentin
>

Dmitri.
--



reply via email to

[Prev in Thread] Current Thread [Next in Thread]