View Full Version : changing a variable in a file
matlab4t
20 Feb 2008, 01:12am
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.
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.
matlab4t
20 Feb 2008, 05:55am
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
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.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.