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

Home » Public Forums » archive » reads/readf into structures with explicit format
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
reads/readf into structures with explicit format [message #79021] Tue, 24 January 2012 15:59
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
I was trying to parse a text file into an array of structures, using
an explicit format, and found that to make it work as I expected, I
had to encapsulate the whole format in extra parentheses:

[520]> lines=['a 0 9','b 1 3']
[521]> s=replicate({a:'-',b:-1,c:-1},2)
[522]> reads,lines,s,format='(A1,2(1X,I1))'
% READS: End of input data encountered: LINES
% Execution halted at: $MAIN$
[523]> print,s
{ a 0 9}{ 0 0 -1}
[524]> reads,lines,s,format='((A1,2(1X,I1)))'
[525]> print,s
{ a 0 9}{ b 1 3}

A corresponding difference happens using print with explicit format.

I was not aware that the extra parentheses would make a difference. Is
this how it is supposed to work, or is this a bug?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: mapping/interpolation from one irregular grid to another (different) irregular grid.
Next Topic: Re: IDLVM and execute

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

Current Time: Fri Oct 10 04:31:28 PDT 2025

Total time taken to generate the page: 1.04318 seconds