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: Mike Miller
Subject: RE: Editing .txt file in Octave
Date: Thu, 18 Mar 2010 08:41:05 -0500 (CDT)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Thu, 18 Mar 2010, socware wrote:

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


There are two columns. I want to use the values from both the columns as
range of x and y respectively in a for loop.

My problem is first I need to change the format from 30m to .00030 or to
some other format like 30e-3

The two answers you suggest are different:  .00030 != 30e-3
Maybe m means micro and you meant .000030 or 30e-6.
Or maybe m means milli and you meant .030 or 30e-3.

Secondly each column have more than 1000 values and I want to use all of them and also if possible specify to use for instance the first 500 values or values in between too.

Thank you for the feedback and help.

You are using Cygwin, so if you don't have perl, install it. Then do this:

perl -pe 's/m/e-3/g ; s/n/e-9/g' infile > outfile

Where your original file is "infile" and you create "outfile".

I am assuming m is micro or 10^-3 and n is nano or 10^-9. If you also have u for micro (10^-6), then you can do this to get all three:

perl -pe 's/m/e-3/g ; s/u/e-6/g ; s/n/e-9/g' infile > outfile

This replaces all m, u and n characters, so it implicitly assumes that they play only this role (setting the exponent) in the file.

Mike


reply via email to

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