×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Create a nodes file to be read by NREAD??

Create a nodes file to be read by NREAD??

Create a nodes file to be read by NREAD??

(OP)
Hi,

How to create a nodes file to be read by NREAD? I can’t seam to find the right format of file to be able to create nodes with NREAD. I used NWRITE to check the file format but it still doesn’t work. What’s the format (I8, 6G20.13) that NWRITE uses?

PS: Before reading the file (NREAD), the element type was specified.

Thanks,

Here are some examples.

File from NWRITE
       1
       2 0.5526100000000E-02 0.6182280000000    
       3 0.4456532258065E-04 0.4985709677419E-02
       4 0.8913064516129E-04 0.9971419354839E-02
       5 0.1336959677419E-03 0.1495712903226E-01
       6 0.1782612903226E-03 0.1994283870968E-01
       7 0.2228266129032E-03 0.2492854838710E-01
       8 0.2673919354839E-03 0.2991425806452E-01
       9 0.3119572580645E-03 0.3489996774194E-01

Works with NREAD

File from NWRITE modified ( added Z values and changed E for e)
       1
       2 0.5375159707773e-02 0.5402480264766     0.3099272175625
       3 0.4456532258065e-04 0.4985709677419e-02 0.6182280000000
       4 0.8913064516129e-04 0.9971419354839e-02 0.9971419354839e-02
       5 0.1336959677419e-03 0.1495712903226e-01 0.9971419354839e-02
       6 0.1782612903226e-03 0.1994283870968e-01 0.9971419354839e-02
       7 0.2228266129032e-03 0.2492854838710e-01 0.1495712903226e-01
       8 0.2673919354839e-03 0.2991425806452e-01 0.1495712903226e-01
       9 0.3119572580645e-03 0.3489996774194e-01 0.1495712903226e-01

Works with NREAD

File from MATLAB (dlmwrite, 14 digits precision)

1    -525.37515907773    540.92480264766    -30.379272175625
2    -260.47801009582    773.65019895784    -39.726405803027
3    -398.33438474916    698.7677590057    -34.854270319014
4    -353.42550861994    727.19981543301    -36.616499075492
5    -502.55370837837    408.58855133112    -31.528843577056
6    -455.74447991072    319.0380154567    -32.661907016793
7    -343.16047945133    821.48253969116    -40.340795529849
8    -179.97847924728    388.8076710432    -32.310835595606
9    -477.31026663364    506.48724347928    -30.831110946955
Doesn’t work with NREAD

File from MATLAB (dlmwrite, 14 digits precision) but changed.

    1 -0.5375159707773 0.5402480264766 -0.3099272175625
    2 -0.2647801009582 0.7735019895784 -0.3926405803027
    3 -0.3933438474916 0.6986775900576 -0.3454270319014
     4 -0.3542550861994 0.7279981543301 -0.3616499075492
    5 -0.5055370837837 0.4088855133112 -0.3128843577056
    6 -0.4574447991072 0.3193801545677 -0.3261907016793
    7 -0.3416047945133 0.8218253969116 -0.4040795529849
    8 -0.1797847924728 0.3880767104329 -0.3210835595606
    9 -0.4731026663364 0.5068724347928 -0.3031110946955
Doesn’t work with NREAD

File from MATLAB (dlmwrite, 14 digits precision) but changed.
       1 -525.37515907773 540.92480264766 -30.379272175625
       2 -260.47801009582 773.65019895784 -39.726405803027
       3 -398.33438474916 698.76775900576 -34.854270319014
       4 -353.42550861994 727.19981543301 -36.616499075492
       5 -502.55370837837 408.58855133112 -31.528843577056
       6 -455.74447991072 319.03801545677 -32.661907016793
       7 -343.16047945133 821.48253969116 -40.340795529849
       8 -179.97847924728 388.80767104329 -32.310835595606
       9 -477.31026663364 506.48724347928 -30.831110946955

Doesn’t work with NREAD


File from MATLAB (save  -ascii)

  1.0000000e+000 -5.2537516e+002  5.4092480e+002 -3.0379272e+001
  2.0000000e+000 -2.6047801e+002  7.7365020e+002 -3.9726406e+001
  3.0000000e+000 -3.9833438e+002  6.9876776e+002 -3.4854270e+001
  4.0000000e+000 -3.5342551e+002  7.2719982e+002 -3.6616499e+001
  5.0000000e+000 -5.0255371e+002  4.0858855e+002 -3.1528844e+001
  6.0000000e+000 -4.5574448e+002  3.1903802e+002 -3.2661907e+001
  7.0000000e+000 -3.4316048e+002  8.2148254e+002 -4.0340796e+001
  8.0000000e+000 -1.7997848e+002  3.8880767e+002 -3.2310836e+001
  9.0000000e+000 -4.7731027e+002  5.0648724e+002 -3.0831111e+001
  1.0000000e+001 -3.3847569e+002  7.5061756e+002 -3.7743572e+001
Doesn’t work with NREAD

File from MATLAB (save  -ascii) but changed

  1 -5.2537516e+002  5.4092480e+002 -3.0379272e+001
  2 -2.6047801e+002  7.7365020e+002 -3.9726406e+001
  3 -3.9833438e+002  6.9876776e+002 -3.4854270e+001
  4 -3.5342551e+002  7.2719982e+002 -3.6616499e+001
  5 -5.0255371e+002  4.0858855e+002 -3.1528844e+001
  6 -4.5574448e+002  3.1903802e+002 -3.2661907e+001
  7 -3.4316048e+002  8.2148254e+002 -4.0340796e+001
  8 -1.7997848e+002  3.8880767e+002 -3.2310836e+001
  9 -4.7731027e+002  5.0648724e+002 -3.0831111e+001
  1 -3.3847569e+002  7.5061756e+002 -3.7743572e+001
Doesn’t work with NREAD

File from MATLAB (save  -ascii -double -tabs)

  1.0000000000000000e+000     -5.2537515907773434e+002      5.4092480264765675e+002     -3.0379272175625175e+001    
  2.0000000000000000e+000     -2.6047801009582111e+002      7.7365019895784212e+002     -3.9726405803026907e+001    
  3.0000000000000000e+000     -3.9833438474916392e+002      6.9876775900570044e+002     -3.4854270319013828e+001    
  4.0000000000000000e+000     -3.5342550861994278e+002      7.2719981543301174e+002     -3.6616499075492413e+001    
  5.0000000000000000e+000     -5.0255370837837057e+002      4.0858855133112098e+002     -3.1528843577055575e+001    
  6.0000000000000000e+000     -4.5574447991071929e+002      3.1903801545670387e+002     -3.2661907016793322e+001    
  7.0000000000000000e+000     -3.4316047945133425e+002      8.2148253969115660e+002     -4.0340795529848968e+001    
  8.0000000000000000e+000     -1.7997847924727580e+002      3.8880767104319517e+002     -3.2310835595605724e+001    
  9.0000000000000000e+000     -4.7731026663363809e+002      5.0648724347928248e+002     -3.0831110946955317e+001    
  1.0000000000000000e+001     -3.3847568914050169e+002      7.5061756108116697e+002     -3.7743571713360403e+001    

Doesn’t work with NREAD




RE: Create a nodes file to be read by NREAD??

Hi,
it seems to me that every file that doesn't work with NREAD has one or several formatting inconsistencies:
- the fields must be fixed-width
- the fields must be separated by space(s) (NEVER by a tabulation)
- although it's not rigorously mandatory, you'd better format the scientific notation as -X.XXXXXXE-YY (where the sign - can obviously be replaced by +). It's mandatory to have 2 digits in the exponent (sign excluded). In order to know how many digits to use in the decimal part, look at how many there are in the NWRITE. I seem to remember that the total column width for each field is 10 characters (signs included)

Regards

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources