help-octave
[Top][All Lists]
Advanced

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

Re: simple advice needed on input and output


From: c.
Subject: Re: simple advice needed on input and output
Date: Sun, 8 Jul 2012 09:43:33 +0200

Il giorno 08/lug/2012, alle ore 08.26, marco atzeri ha scritto:

> On 7/8/2012 7:53 AM, c. wrote:
>> 
>> Il giorno 08/lug/2012, alle ore 07.00, vilsu ha scritto:
>> 
>>> fid = fopen ("in.txt");
>>>     for i = 1:229799
>>>        x = eval (fgetl (fid))
>>>        save -append out.txt x
>>>     endfor;
>>> fclose (fid)
>> 
>> Is this reading the whole contents of the file "in.txt"?
>> If it is so, then your code is equivalent to:
>> 
>> source in.txt
>> save out.txt x
>> 
>> c.
>> 
> 
> 
> the file seems to have no headers, so probably this way
> is more indicated
> 
> x=load("-ascii", "in.txt")
> save out.txt x
> 
> 
> Marco

Marco,

The file contains code, not data. Therefore "source" should be more appropriate 
than "load".
The file is essentially a script, it can't be run directly only because of its 
extension.
If it were named "in.n" rather than "in.txt" 

in
save out.txt

would also suffice.
c.





reply via email to

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