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: Stefan Neumann
Subject: Re: Editing .txt file in Octave
Date: Thu, 18 Mar 2010 23:02:33 +0100



2010/3/18 John W. Eaton <address@hidden>
On 18-Mar-2010, Stefan Neumann wrote:

| 2010/3/18 socware <address@hidden>
| 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.

OK.

Does this assume that in column 1the letter "m" occurs in every line, no other letter and no number without letter?
And in column 2 always "n" ?

What happens if there are different letters in the same column, for example mixing "milli" and "micro" or having geographical coordinates with "E" and "W"?

cheers,
stn
 

jwe


reply via email to

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