output an array to a text file
output an array to a text file
(OP)
Hello,
Can someone advise me on how to output an array to a text file? The array itself is ~600 x ~700 x 1. Ideally I'd like to output it to a file whilst the data retains it's position, i.e. ~600 columns not 1 column that I then have to go through and manually put back into the original columns.
I've tried *VWRITE but this seems to have limits of 19 parameters, I've tried using *MWRITE but this hasn't worked at all for me. Either giving out lots of ****** or just giving me one result or putting all the results into one column.
Thanks
George
Can someone advise me on how to output an array to a text file? The array itself is ~600 x ~700 x 1. Ideally I'd like to output it to a file whilst the data retains it's position, i.e. ~600 columns not 1 column that I then have to go through and manually put back into the original columns.
I've tried *VWRITE but this seems to have limits of 19 parameters, I've tried using *MWRITE but this hasn't worked at all for me. Either giving out lots of ****** or just giving me one result or putting all the results into one column.
Thanks
George





RE: output an array to a text file
Put your *VWRITE in a *do loop. It sould work fine.
Regards,
Orel
RE: output an array to a text file
Thanks for the tip. I've tried that but it's writing all the data to the first column. Is there a way to keep the row and column structure of the array?
Thanks
George
RE: output an array to a text file
(F10.5, ' ', F10.5, ' ', F10.5)
' ' => separation between values (4 spaces here)
F10.5 => fortran format for numbers
I didn't test it so you might have to change it a little bit.
RE: output an array to a text file
RE: output an array to a text file
*mwrite,your_file,file_ext,,jik,600
(600F6.0)
Learn how to use fortran format number, here, F6.0 will right floats on 6 chars with 0 decimals ie :
----1. for 1 (- are blanks)
---1.1 for 1.1
If Ansys writes starts, it just tells you that the format is not right, like writing 1234.56 with F3.0
If you don't have exactly 600 colums, ve sure to replace 600 in both lines.
Tested it with random numbers on 50x600 table, works fine.