XANSYS Message: 40996 [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: Gordon May
Date: 2002-08-22 09:38:00

One option would seem to be to read the data into a character array:

*dim,textdata,CHAR,xsize,ysize,zsize
*dim,numdata,ARRAY,xsize,ysize,zsize
*vread,textdata(1,1,1),filename
(1A8)

and then use

numdata(x,y,z) = VALCHR(textdata(x,y,z))

to convert back into numerical data. I don't think there's a quick vector
operation to do this, so it could be VERY slow if your arrays are large...
and of course there's the problem if your numerical data is not fully
contained within the first eight characters of each input record :-(

Gordon May
Principal Technologist - Optimization
Mechanical Methods & Design Technology
Tel.: +44 (0)1332 2 44041
Fax: +44 (0)1332 2 44874
mailto:gordon.may@r...

"If you speak to him of a machine for peeling a potato, he will pronounce it
impossible: if you peel a potato with it before his eyes, he will declare it
useless, because it will not slice a pineapple."

Charles Babbage

-----Original Message-----
Sent: Thursday, August 22, 2002 2:12 PM
To: xansys@yahoogroups.com

Dave, Peter,

No, the characters may not always be the first group of lines. NSKIP
doesn't work in this case.

Joe Metrisin
Florida Turbine Technologies, Inc.

--- In xansys@y..., pfrei@r... wrote:
> Joe,

> Do you always have the same number of lines with characters? Are
they
> always at the beginning of the data file (as your sample data file
> suggests)? If so, have you tried the NSKIP option of *VREAD?

> Peter

> Peter U. Frei, Rockwell Automation AG, IEC Power Components, Dept.
ER
> Buchserstrasse 35, CH-5001 Aarau, Switzerland
> pfrei@r..., phone: +41 62 837 24 47, fax: +41 62 837 29 17

> Joe Metrisin
> 22.08.02 14:27
> Please respond to xansys

> To: "'xansys@y...'"
> cc:
> Subject: [xansys] [APDL] *vread with mixed
character/number array.

> Greetings,

> Does anyone know of a way to *VREAD a column of data that may have
a few
> rows with characters? ANSYS will abort the *VREAD if it encounters
any
> characters in the column. Even using a mask vector to tell ANSYS
to skip
> the character rows does not work. I want ANSYS to ignore the
character
> rows
> and just read the numbers.

> Below is a snippet to illustrate the problem:

> Data file:

> aaaaaaaaabbbbbbbb
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10

> Macro:

> *dim, mask_, array, 10
> *vfill, mask_(1), ramp, 0.

> *do, i_, 2, 10, 2
> mask_(i_) = 1
> *enddo

> *dim, data_, array, 10
> *vmask, mask_(1)
> *vread, data_(1), 'junk.dat'
> (f20.0)

> Thanks.

> Joe Metrisin
> Florida Turbine Technologies, Inc.


Posts possibly associated with message #40996AuthorDateScore
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 
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 
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