help-octave
[Top][All Lists]
Advanced

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

Re:


From: Andrey Romanenko
Subject: Re:
Date: Wed, 19 Apr 2006 20:11:26 +0100
User-agent: KMail/1.8.3

Hi! 

On Wednesday 19 April 2006 18:49, Dmitri A. Sergatskov wrote:
> On 4/19/06, Carine Simon <address@hidden> wrote:
> > Hello,
> >
> > I've got a problem which I think is rather stupid but I can't solve it so
> > here I am: I need to save matrices in files with no header at all in
> > order to be able to use it within another software. I have found the
> > variable "save_header_format_string" but I've still got the information
> > on number of rows and columns etc. Any ideas?
>
> You can always use C-style formatting:
>
> octave:1> a=zeros(3,5)
> a =
>
>   0  0  0  0  0
>   0  0  0  0  0
>   0  0  0  0  0
>
> octave:2> fid=fopen("myfile.cvs","w")
> fid = 3
> octave:3> fprintf(fid,"%f,%f,%f\n", a)
> octave:4> fclose(fid)
> ans = 0

The following works for matrices of any dimension:

a=randn(4,4);
save -ascii data a
system("grep -v \"#\" data > data.tmp; mv data.tmp data");

Andrey


reply via email to

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