changing a variable in a file

edited February 2008 in Science & Tech
hi guys,

i have a file 121.py. its a python script file from abaqus. i have to change a single variable in that file and make it to run again . the value which i have to change in my 121.py is a node number, and i have the node numbers from matlab , which are to be placed in the script file. can anyone let me know how to do it.

Comments

  • JBJB Carlsbad, CA
    edited February 2008
    If the numbers from Matlab are deterministic you can simply run that script once and then store the results to a file or a hard-coded array in your Python script.
  • edited February 2008
    JB wrote:
    If the numbers from Matlab are deterministic you can simply run that script once and then store the results to a file or a hard-coded array in your Python script.


    i am having few nodes numbers stored in c = [27 52 102 345]. i have them from matlab. now i have to send these numbers into my script file (121.py) and run cases for all those node numbers. so i wanted to know if i can send these numbers one by one into the script file (121.py) and run it.

    can u elaborate on your method.

    thank you for ur reply

    Matlab4t
  • JBJB Carlsbad, CA
    edited February 2008
    Well, it depends on how your script is implemented. If it expects parameters to be passed in on the command line then you have to write a loop from your shell.

    If you hard code the array in the script you have to write a loop in Python to iterate through all the values.
Sign In or Register to comment.