help-octave
[Top][All Lists]
Advanced

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

RE: saving files without header


From: Hall, Benjamin
Subject: RE: saving files without header
Date: Tue, 3 May 2005 14:32:50 -0400

> Hmmm...
> How could you do the same but in rows instead of columns ?


a = [1:1000];
b = a.^2;
c = -a;

dat = [a' b' c'];
fmt_str = repmat('%g ',[1 size(dat,2)]);
fmt_str = [ fmt_str '\n' ];

fid = fopen('somefile.txt','wt');
fprintf( fid, fmt_str, dat );
fclose(fid);


-----Original Message-----
From: Keith Goodman [mailto:address@hidden
Sent: Tuesday, May 03, 2005 2:12 PM
To: fred
Cc: address@hidden
Subject: Re: saving files without header


fprintf(fid,"%g,",a);
fprintf(fid,"\n");
fprintf(fid,"%g,",b);
fprintf(fid,"\n");
fprintf(fid,"%g,",c);

On 5/3/05, fred <address@hidden> wrote:
> Dmitri A. Sergatskov a écrit :
> > Dmitri A. Sergatskov wrote:
> >
> >>
> >>
> >> fid = fopen("1_frequency.tmp","w");
> >> fprintf("%g ",frequency);
> 
> Hmmm...
> How could you do the same but in rows instead of columns ?
> 
> I try
> 
>    a = [1:1000];
>    b = a.^2;
>    c = -a;
> 
>    file = fopen("gloups","wt");
>    fprintf(file, "%g %g %g\n", a, b, c);
>    fclose(file);
> 
> but it does not work : I have all a values, then b, then c.
> 
> Another solution is a do-loop but it is _very_ slow for long tab.
> 
> Thx.
> 
> --
> Fred.
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 
>



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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