×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-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!
  • Students Click Here

*Eng-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

Jobs

ANSYS: Writing large string/values arrays into a txt file using VWRITE

ANSYS: Writing large string/values arrays into a txt file using VWRITE

ANSYS: Writing large string/values arrays into a txt file using VWRITE

(OP)
Hello,

Here's the short summary. I have two arrays:

- String array:

*DIM,header_names,STRING,128,50

header_names (1,1)='name_longer_than_8_digits'
header_names (1,2)='another_name'
header_names (1,3)= 'yet_another_name'
...
header_names (1,50)='last_name'

- Values array:

*DIM,values, ,50,100

*DO,x,1,50
*DO,y,1,100

values(x,y)=x+y

*ENDDO
*ENDDO

The main point here is that my macro is supposed to work on more than 19 parameters (which is a limtation for VWRITE) and the number of parameters is varying depends on user input. Using of manually created series of "%G,%G,%G ..." or "%C,%C,%C ..." corresponding to the number of elements in array is what I would like to avoid.

Having the following for writing into txt file:

- String array:

*CFOPEN,results,txt
*VWRITE,header_names(1,1)
%C,
*CFCLOS

results in writing the headers as a column instead of row.

- Values array

*CFOPEN,results,txt,,append
*VWRITE, values(1,1)
(2x,f18.6,$,',')
*VWRITE,
(1x)
*CFCLOS

Values are written properly, only one line, but horizontally, so that's what I want to achieve. How can this be done for headers, should I define the string array differently, or use different Fortran/C operators ?

Thank you,  

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 Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

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

Click Here to join Eng-Tips and talk with other members!


Resources