← Back to team overview

yade-users team mailing list archive

Re: [Question #407555]: read Parameters from external file (non batch mode)

 

Question #407555 on Yade changed:
https://answers.launchpad.net/yade/+question/407555

    Status: Open => Answered

Klaus Thoeni proposed the following answer:
Hi,

I guess this is more a python related question unless you want to do a
parameter study and run Yade in batch mode. For the latter have a look
here [1]. In case you don't want to do a parameter study and just load
some variables you could just use pythons read command, e.g., for
reading a text file line by line use something like this:

f = open("datafile.txt")
for line in f:
    do_stuff(line) # here you do whatever you need to do with the line/value
f.close()

If you want to load a vector/matrix use the loadtxt command from numpy
package:

import numpy as np
data = np.loadtxt("datafile.txt")

For more python specific answers look at the corresponding
documentation.

HTH
Klaus

[1] https://yade-dem.org/doc/tutorial-geo.html

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