Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTN95 - Summing specific data

Status
Not open for further replies.

rw511

Technical User
Oct 3, 2010
1
GB
Howdy, fairly new to FTN95 so excuse me if what I'm after is ridiculously simple.

I've got a list of data, (*.dat file) that I'm inputting into my code, 210 lines long. The data is subdivided into a few different areas but basically I want to extract every 5th line. So, 1st,6th,11th... and 2nd,7th,12th...etc. I've managed to input the data and be able to recall any particular value and work out averages of the entire data (which in fact is useless) but cannot for the life of me figure out a way to sum (for example) every 5th line to make the data useful. Any input is much appreciated (excuse the pun!)

Regards, Rich.
 
While reading the lines from DAT-file you can count them and perform modulo 5 operation.
If the result of count modulo 5 is 1 - then you are on 1th, 6th,... line, if it's 2 then you are on 2nd, 7th, ... line
...etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top