Create an array/Arrays based on a TXT file

Asked

Viewed 102 times

4

I am new to using the Fortran/95 language and want to extract some data from a txt file (http://1drv.ms/20gSNKb), are flow data available in the Hidroweb portal. Whereas they are separated by ";" as the example:

//EstacaoCodigo;NivelConsistencia;Data;Hora;MediaDiaria;MetodoObtencaoVazoes;Maxima;Minima;Media;DiaMaxima;DiaMinima;MaximaStatus;MinimaStatus;MediaStatus
88850000;2;08/01/1964;;1;1;;;;;;0;0;0
88850000;2;09/01/1964;;1;1;50.24;2.78;6.446;30;14;1;1;1
88850000;2;10/01/1964;;1;1;364.4;3.26;1.744.774;9;31;1;1;1
88850000;2;11/01/1964;;1;1;7.6;1.18;2.224;21;27;1;1;1
88850000;2;12/01/1964;;1;1;3.1;0.575;1.118.226;2;21;1;1;1
88850000;2;01/01/1965;;1;1;16.2;0.315;1.214.194;17;14;1;1;1
88850000;2;02/01/1965;;1;1;6.6;0.1762;0.6019143;3;21;1;1;1
88850000;2;03/01/1965;;1;1;63;0.127;6.706.581;28;10;1;1;1

I need to input this data and get the information related to the columns Est - Date - Maximum - Average - Minimum and generate a new txt.

The routine I built is described below

 PROGRAM dadospluv
 IMPLICIT NONE
 integer :: i
 OPEN(UNIT=10, FILE="vazoes_bruna.txt", STATUS='OLD', ACTION='READ')
 READ(10,*) n, (a(i), i=1,n)

I’m wondering how I can create the array/arrays to manipulate the data. Any hints?

  • 1

    Welcome to SOPT @Bruna, could [Edit] your question and clarify, put some piece of code that you have already tried to perform, as are the data in this text file, could post? How should the text layout of the file be organized in the matrix? Thank you.

  • 6

    @I answered your other question in Read files with ";" in Fortran. Please check if you helped resolve the question to read the data.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.