Question #402989 on Yade changed:

Hien N.G. NGUYEN posted a new comment:
I would like to add more details to Bruno's answer on how to save to external 
In Python/YADE you can use the command WRITE(), let's say you create a variable 
'a' to store your data's info:

a=open('allinfo','w') #allinfo is the name of the file, w is write

Then do the loop as Bruno mentioned:

for b in O.bodies:
  a.write(str(b.state.pos[0]), str(b.state.pos[1]), str(b.state.pos[2])+'\n')

a.close() #close the file

Check in the folder where you launch this script, the file should be
'allinfo' which contains the data you need, line by line. Then load it
in to excel or matlab or whatever for post processing.

My other advice is to save anyway the full model (xml.gz) so that you can 
recall more data later on. You won't know what data you'll need more in the 
future, better save them all.
Anyway keeping the data as txt/csv is a good idea, since maybe you can work 
with it in Windows other time. This might be not ideal but that's what I did 
during my thesis and it's just fine.


You received this question notification because your team yade-users is
an answer contact for Yade.

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to