Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to export a table of values from ansys towards Excel 2

Status
Not open for further replies.

biblo

Mechanical
Apr 23, 2006
40
Hi everybody!!
I would like to send a table of results starting from ANSYS towards EXCEL. How can i do that please.
Thank's in advance!!
Barha.
 
Replies continue below

Recommended for you

Store them as a table or array parameter and use the *VWRITE command to write them to a *.dat file.

-Brian
 
Hi,

I think, the *mwrite command is more suitable for that:

Code:
*mwrite,array(1),filename,dat
(10E14.20)

The number 10 in front of E14 is the number of array columns.

Regards,
Alex
 
but how to export it to excel??? please explain much more my freinds!!
Barha
 
Barha,
Ansys can store numbers in matrices or vector arrays which are contained within a database. Here's a very general sample input which you would typically use to create an array, fill that array, and write it out to a file which can be used by Excel.

*DIM ! This command is used to dimension an array parameter or table
*DO ! Using do-loops is a convenient way to fill in parameters with multiple rows and columns. You can have multiple do-loops within each other. So one do-loop would fill rows, the do-loop nested within that may fill columns, you get the idea.
*VGET ! Use this to retrieve values which are to be stored in the array parameter itself. This may be a nodal temperature, force, anything really.
*ENDDO !You need to end the do-loop.
*CFOPEN !This creates and/or opens a file which output will be directed to.
*VWRITE !This writes specific data out to the file which you have specified above.
*CFCLOS !This closes the file when all information has been written out.

Again, this is very general and should give you a good start. Look at these commands or perhaps find some sample macros which other people have used to do similar and you should find what you need.

Good luck,
-Brian
 
Thank you Brian but it is not there my problem but it is with Excel. If for example TEMP1 is my array:
*DIM, TEMP1,20,30
*DO,I,1,20
*DO,J,1,30
TEMP1(I,J)=2*I+3*J
*ENDDO
*ENDDO
*mwrite,TEMPE,barha,dat
When I go in Excel to read this file (barha.dat) it gives me a vector with values all equal to this value: ALLS!!
 
No wonder that it don't works, if you don't say Ansys, how it should write the matrix. Did you used something like this in your code:

(10E14.20)

???

This sets the Format of the Numbers and MUST follow after the *mwrite command.

 
Biblo,
Your input was incorrect in the usage of the *DIM command. You do not specify what type of parameter you are dimensioning with the *DIM command. Try this:

*DIM, TEMP1,ARRAY,20,30
*DO,I,1,20
*DO,J,1,30
TEMP1(I,J)=2*I+3*J
*ENDDO
*ENDDO
*mwrite,TEMPE,barha,dat
 
I forgot to write the format (10E14.20). Now, even with that, the problem still persists. I think that I do not make well the importation of data in Excel!!
 
Stringmaker lolll!!
I just forgot it here not in my program. In my program i used :
*DIM,TEMP1,ARRAY,20,30
*DO,I,1,20
*DO,J,1,30
TEMP1(I,J)=2*I+3*J
*ENDDO
*ENDDO
*mwrite,TEMPE,barha,dat
(10E14.20)
 
is there somethng special to do in Excel to read my file : barha.dat?
 
thank you my friends!!!!
i use this format (E10.3,2X,D8.2) and it work well!!!
thank's a lot Brian and Alex
regards, Barha.
 
Barha, try using this input:

*DIM,TEMP1,ARRAY,20,30
*DO,I,1,20
*DO,J,1,30
TEMP1(I,J)=2*I+3*J
*ENDDO
*ENDDO
*mwrite,TEMP1,barha,dat !in your input above the array specified was incorrect
(30F10.0)

To get Excel to read in your data just simply open the file and make sure you import it as Delimited and that Spaces and Tabs are checked as your delimiters.

-Brian
 
also the error in TEMPE i just do it here not in my program.
When i used this format (E10.3,2X,D8.2) i found that Excel is not precise (it take for exemple : 1401.2 as 1400) but with your format (30F10.0) i found the right precision. So thank's a lot Brian!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor