General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

How to write Array to file

    • solani
      Subscriber

      Hello,

      in post-processing I created an array. How can I export it to a txt file? Furthermore: is there a possibilty to export two arrays in one file? (like columns in a csv file)

      I tried *MWRITE, avg_temp_vector,C:Usersfoldernamefilename,txt so far but it does not seem to work.

      Best regards and thank you in advance,

      Ani

    • Erik Kostson
      Ansys Employee
      Never used this - the link has an example that needs to be run from text file and read input from apdl to get it to work.

      Hope this helps

      Erik
    • solani
      Subscriber
      Hello Erik thank you, this helped. I solved the problem like this:
      ! Write to txt file
      *CFOPEN, 'filename.txt'
      *VWRITE, array_wanted1(1), '; ',array_wanted2(1)
      (F,A2,F)
      !Format A=String, F=FLoat -> https://web.stanford.edu/class/me200c/tutorial_77/17_format.html
      *cfclose
    • ikergv
      Subscriber
      you can use C format as well
      Write to txt file

      *CFOPEN, 'filename.txt'
      *VWRITE, array_wanted1(1),array_wanted2(1)
      %f; %f
      *cfclose

Viewing 3 reply threads
  • The topic ‘How to write Array to file’ is closed to new replies.