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 13:28:41 +0100



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.


So here is one solution that works but is not really a native octave-solution:
Use a text-editor an replace all "m" with "e-3" and all "n" with "e-9".

30e-3              399.14e-9
31e-3              412.216e-9
32e-3              425.291e-9
33e-3              438.367e-9
34e-3              451.442e-9

Then the script works fine. The matrix m contains your values and can be used for further processing.

I'll look for a "native solution", maybe later.

stn




reply via email to

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