comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Read ASCII line till semicolon
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Read ASCII line till semicolon [message #93248] Thu, 19 May 2016 09:21 Go to next message
Gompie is currently offline  Gompie
Messages: 76
Registered: August 2012
Member
Hi
I have an ASCII file like this

0.5278094 0.3206182 0.144641 0.06570376 0.1231144 0.2697486
-0.06622537 -1.551116;
0.5228434 0.3176388 0.1095919 0.04126258 0.1140051 0.2344392
-0.1165814 -1.565449;

Each of my line ends with a semicolon. Unfortunately there is a new line character after 6 floats. How can i read the full line uptill the semi colon into an array.
Gompie
Re: Read ASCII line till semicolon [message #93251 is a reply to message #93248] Fri, 20 May 2016 01:33 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den torsdag 19 maj 2016 kl. 18:21:06 UTC+2 skrev Gompie:
> Hi
> I have an ASCII file like this
>
> 0.5278094 0.3206182 0.144641 0.06570376 0.1231144 0.2697486
> -0.06622537 -1.551116;
> 0.5228434 0.3176388 0.1095919 0.04126258 0.1140051 0.2344392
> -0.1165814 -1.565449;
>
> Each of my line ends with a semicolon. Unfortunately there is a new line character after 6 floats. How can i read the full line uptill the semi colon into an array.
> Gompie

If you don't need the actual lines as strings, you can easily read the floats:

a = fltarr(8, 2)

openr, 1, 'tmp.txt'
readf, 1, a
close, 1
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL to Python bridge and "file-like" Python object
Next Topic: generate sequential list

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:17:35 PDT 2025

Total time taken to generate the page: 0.00470 seconds