XANSYS Message: 41213 [Go back to message list]
[bookmark on del.icio.us]
No rating yet
Rate item:

Subject: Re: [APDL] *vread with mixed character/number array
Author: John Swanson
Date: 2002-08-28 09:38:00

For those following this thread, here is a demonstration of my proposed
improvements.

John Swanson
Swanson Analysis Services, Inc.

***** test of /inquire and *vread improvements *****
1 /BATCH,list
2
3 *create,x,inp
4 ! test input file
5 !set 1
6 1.0
7 !
8 2.0
9 ! this is a blank line
10 3.0
11 !set 2
12 11.0!comment allowed
13 just text
14 12.0
15 !
16 13.0
17 *end
18 *list,x,inp
19
20 C*** get the number of lines in the file
21 /inquire,a,line,x,inp
22 C*** get the location of the first 'set'
23 /inquire,b,loc,x,inp,,set,0
24 C*** get the location of the second 'set'
25 /inquire,c,loc,x,inp,,set,b
26
27 *dim,vect,,3
28 C*** read in the data from set 1
29 *vread,vect(1),x,inp,,IJK,3,,,b,1
30 (f6.0)
31 x=_return
32 *stat,vect(1)
33
34 c*** read in the data from set 2
35 *vread,vect(1),x,inp,,IJK,3,,,c,1
36 (f6.0)
37 x=_return
38 *stat,vect(1)
39
40 c*** put the data from lines b+1 (3) to c (8) into character array
41 *sread,a1,x,inp,,,b+1,c
42 x=_return
43 *stat,a1(1,1)
44
45 /eof

START CREATE BY COPY FROM INPUT TO x.inp

END FILE CREATE

LISTING OF THE DATA ON FILE x.inp
! test input file
!set 1
1.0
!
2.0
! this is a blank line
3.0
!set 2
11.0!comment allowed
just text
12.0
!
13.0

C*** get the number of lines in the file

PARAMETER A = 13.000000

C*** get the location of the first 'set'

PARAMETER B = 2.000000

C*** get the location of the second 'set'

PARAMETER C = 8.000000

SET PARAMETER DIMENSIONS ON VECT TYPE=ARRA DIMENSIONS= 3 1 1

C*** read in the data from set 1

VECTOR READ OPERATION *VREAD
VECT READ FROM FILE x.inp
VECTOR LENGTH= 3
LOOP DIRECTIONS=IJK COUNTS= 3 1 1
NUMBER OF LINES TO SKIP AT START OF FILE= 2
NUMBER OF FIELDS PER LINE= 1
FORMAT=(f6.0)

PARAMETER X = 7.000000

PARAMETER STATUS- VECT ( 7 PARAMETERS DEFINED)
(INCLUDING 2 INTERNAL PARAMETERS)

LOCATION VALUE
1 1 1 1.00000000
2 1 1 2.00000000
3 1 1 3.00000000

c*** read in the data from set 2

VECTOR READ OPERATION *VREAD
VECT READ FROM FILE x.inp
VECTOR LENGTH= 3
LOOP DIRECTIONS=IJK COUNTS= 3 1 1
NUMBER OF LINES TO SKIP AT START OF FILE= 8
NUMBER OF FIELDS PER LINE= 1
FORMAT=(f6.0)

PARAMETER X = 13.00000

PARAMETER STATUS- VECT ( 7 PARAMETERS DEFINED)
(INCLUDING 2 INTERNAL PARAMETERS)

LOCATION VALUE
1 1 1 11.0000000
2 1 1 12.0000000
3 1 1 13.0000000

c*** put the data from lines b+1 (3) to c (8) into character array

READ FILE INTO STRING ARRAY = A1
x.inp
SKIP FIRST 3 LINES
READ 8 LINES
Number of lines = 8

PARAMETER X = 11.00000

PARAMETER STATUS- A1 ( 8 PARAMETERS DEFINED)
(INCLUDING 2 INTERNAL PARAMETERS)
28 1 1 !
28 2 1 2.0
28 3 1 ! this is a blank line
28 4 1 3.0
28 5 1 !set 2
28 6 1 11.0!comment allowed
28 7 1 just text
28 8 1 12.0

***** END OF INPUT ENCOUNTERED *****

Posts possibly associated with message #41213AuthorDateScore
40991[APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
40992Re: [APDL] *vread with mixed character/number array.Dave Conover2002/08/22 
40993Re: [APDL] *vread with mixed character/number array.Peter Frei2002/08/22 
40994Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
40995Re: [APDL] *vread with mixed character/number array.Ashok2002/08/22 
40996Re: [APDL] *vread with mixed character/number array.Gordon May2002/08/22 
40997Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/22 
40998Re: [APDL] *vread with mixed character/number array.Peter Frei2002/08/22 
40999Re: [APDL] *vread with mixed character/number array.Ian Prentice2002/08/22 
41002Re: [APDL] *vread with mixed character/number array.Don Shaffer2002/08/22 
41011Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/22 
41013Re: [APDL] *vread with mixed character/number array.John Swanson2002/08/22 
41014Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/22 
41077Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/26 
41079Re: [APDL] *vread with mixed character/number array.John Swanson2002/08/26 
41080Re: [APDL] *vread with mixed character/number array.Ashok2002/08/26 
41083Re: [APDL] *vread with mixed character/number array.John Crawford2002/08/26 
41084Re: [APDL] *vread with mixed character/number array.Bob Weathers2002/08/26 
41086Re: [APDL] *vread with mixed character/number array.Ashok2002/08/26 
41093Re: [APDL] *vread with mixed character/number array.John Crawford2002/08/26 
41101Re: [APDL] *vread with mixed character/number array.Joe Metrisin2002/08/26 
41103Re: [APDL] *vread with mixed character/number array.Eric Miller2002/08/265
41106Re: [APDL] *vread with mixed character/number array.Fernand Thomassy2002/08/26 
41110Re: [APDL] *vread with mixed character/number array.Eric Miller2002/08/26 
41112Re: [APDL] *vread with mixed character/number array.Dan Bohlen2002/08/26 
41126Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/26 
41161Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/27 
41162Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/27 
41178Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/27 
41213Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/28 
41216Re: [APDL] *vread with mixed character/number arrayMartin Liddle2002/08/28 
41237Re: [APDL] *vread with mixed character/number arrayBob Weathers2002/08/28 
41239Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/28 
41242Re: [APDL] *vread with mixed character/number arrayJoe Metrisin2002/08/28 
41271Re: [APDL] *vread with mixed character/number arrayFernand Thomassy2002/08/29 
41273Re: [APDL] *vread with mixed character/number arrayJohn Swanson2002/08/29