


{"id":286621,"date":"2023-05-31T20:37:42","date_gmt":"2023-05-31T20:37:42","guid":{"rendered":"\/forum\/forums\/topic\/how-to-write-an-array-to-text-file\/"},"modified":"2023-06-04T06:14:11","modified_gmt":"2023-06-04T06:14:11","slug":"how-to-write-an-array-to-text-file","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-write-an-array-to-text-file\/","title":{"rendered":"How to write an array to text file ?"},"content":{"rendered":"<p>Hi evey one<\/p>\n<p>I used the next code to extract the potential energy of harmonic analysis (10 steps) for some parts of structure simulated with element 185 .&nbsp;<\/p>\n<p>*DIM,energy_array,ARRAY,10<br \/>\/POST1<br \/>i=1<br \/>*DO, step, 1,19, 2&nbsp;<br \/>&nbsp; &nbsp;SET,,,,,,,STEP&nbsp; &nbsp; &nbsp; &nbsp;! store results for set step<br \/>&nbsp; &nbsp;ESEL,S,ENAME,,185<br \/>&nbsp; &nbsp;ETABLE,ENERGY,SENE<br \/>&nbsp; &nbsp;SSUM<br \/>&nbsp; &nbsp;<br \/>&nbsp; &nbsp;*GET,my_energy,SSUM,,ITEM,ENERGY<br \/>&nbsp; &nbsp;energy_array(i)= my_energy<br \/>&nbsp; &nbsp;<br \/>&nbsp; &nbsp;*CFOPEN,ENERGIES,txt,C:\\Users\\MD\\Desktop<br \/>&nbsp; *VWRITE,energy_array<br \/>&nbsp; %(F18.10)<br \/>&nbsp; *CFCLOS<br \/>&nbsp; &nbsp;<br \/>&nbsp; &nbsp;ETABLE,CLEAR<br \/>&nbsp; &nbsp;<br \/>&nbsp; &nbsp;<br \/>&nbsp; &nbsp;ALLSEL<br \/>&nbsp; &nbsp;i=i+1<br \/>*ENDDO<\/p>\n<p>Unfortunately the file ENERGIES.txt is created but empty !!!<\/p>\n<p>Also I need to set parameter &#8220;my_energy&#8221; to record the highst value of the harmonic steps rather than recording last step as this code do.<\/p>\n<p>would any one help me with that code ?<\/p>\n<p>Regards<\/p>\n","protected":false},"template":"","class_list":["post-286621","topic","type-topic","status-closed","hentry","topic-tag-ansys-apdl","topic-tag-harmonic"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["51194","23687","267323"],"_bbp_author_ip":["96.7.74.151"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["2245"],"_edit_lock":["1685613287:117528"],"_bbp_status":["publish"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["286621"],"_bbp_forum_id":["27791"],"_bbp_engagement":["23687","51194","267323"],"_bbp_voice_count":["3"],"_bbp_reply_count":["6"],"_bbp_last_reply_id":["286906"],"_bbp_last_active_id":["286906"],"_bbp_last_active_time":["2023-06-02 16:42:52"]},"test":"md_abdelrhimhotmail-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/286621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/286621\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=286621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}