×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to split a big array data file into several small data files each

How to split a big array data file into several small data files each

How to split a big array data file into several small data files each

(OP)
Hi,

I have a big array of data stored in a file named as 'A.dat'. I would like to split it into many small files (B11.dat, B12.dat, …B21.dat ,B22.dat, …) with each contains a small data  block with size (N X M).

A direct way to deal with it is to read all the data into  a big array A, then try to save
A( (n-1)*N+1 : n*N, (m-1)*M+1 : m*M ) )
to file Bnm.dat conresponding to block (n,m)

But I feel this is too clumsy. There should be a better method to do the same thing. Would anyone please comment on it?
Thanks a lot

RE: How to split a big array data file into several small data files each

The array variable may be equivalenced to a matrix, the first dimension of which is set to N * M. Example :
  DIMENSION A(10000) , B(100,100)
  EQUIVALENCE (A , B )
  CHARACTER FILENAME * 100 , NUMBER * 3
  ........
  DO 50 IFILE = 1 , 100
  WRITE(NUMBER,'(I3)') IFILE
  FILENAME = NUMBER//other text
C NEXT OPEN THE FILE AND WRITE THE SELECTED COLUMN OF B


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close