[Tutor] Extract Block of Data from a 2D Array

Alan Gauld alan.gauld at yahoo.co.uk
Fri Mar 31 10:29:12 EDT 2017


On 31/03/17 13:19, Stephen P. Molnar wrote:
> I have a block of data extracted from a quantum mechanical calculation:

How is this data stored? On paper? In a database? In XML? A CSV file?
Plain text? The answer to that will go a long way to pointing you in the
right direction for a solution.

> CARTESIAN COORDINATES (A.U.)
> ----------------------------
>    NO LB      ZA    FRAG     MASS         X           Y           Z
>     0 C     6.0000    0    12.011   -3.265636    0.198894    0.090858
>     1 C     6.0000    0    12.011   -1.307161    1.522212    1.003463
>     2 C     6.0000    0    12.011    1.213336    0.948208   -0.033373
>     3 N     7.0000    0    14.007    3.238650    1.041523    1.301322
>     4 C     6.0000    0    12.011   -5.954489    0.650878    0.803379
>     5 C     6.0000    0    12.011    5.654476    0.480066    0.013757
> 
> where the number of lines depends upon the molecule being considered.
> 
> I want to extract the block of data starting on line 4 and column 4. 

A block of data needs a start and end. Where is the end?
Also which of the above lines is line 4?
I'd read it as the one starting the actual raw data values.
But it could be the 4th line of values that you want?

It might help to know the OS you are using too because Unix
in particular has some OS level tools that might simplify
preparing the data.
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list