help-octave
[Top][All Lists]
Advanced

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

Re: Editing .txt file in Octave


From: John W. Eaton
Subject: Re: Editing .txt file in Octave
Date: Thu, 18 Mar 2010 14:45:32 -0400

On 18-Mar-2010, Stefan Neumann wrote:

| 2010/3/18 socware <address@hidden>
| 
| >
| > Hello
| > I am in Windows XP (Home) and using Octave 3.2.4 over cygwin.
| >
| > My file looks like this
| >
| > 30m              399.14n
| > 31m              412.216n
| > 32m              425.291n
| > 33m              438.367n
| > 34m              451.442n
| >
| 
| 
| On linux this partially works :-)
| Should be OK for windows too.
| 
| [fid] = fopen("zahleneinlesen_01.n.dat", "r") ; % , "native");
| [m, count] = fscanf(fid, '%f %f',[2,5]);
| fclose(fid);
| m=m';
| m
| 
| It will NOT read something like 30m, though. Numbers only.

It will if you tell fscanf about the characters:

  f = fopen ("foo.dat");
  x = fscanf (f, "%fm %fn");
  x = reshape (x, [2, numel(x)/2])';

>From there, you can scale the columns of X as needed.

jwe


reply via email to

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