Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • 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!

Join Eng-Tips
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think the forum is a great idea, especially for those of us in consulting engineering. Keep up the good work!..."

Geography

Where in the world do Eng-Tips members come from?

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

jgrzmmm (Mechanical)
5 Mar 12 15:47
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,  

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!

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close