help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extract data from file: how to


From: Jan-Peter Schümann
Subject: extract data from file: how to
Date: Tue, 4 Aug 2015 06:35:35 +0200

Hi all,
 
I am having a problem with reading data from a file. My file looks like this (example, the real thing has 100.000 lines or so):
 
Element # = 1 Typ = 10-K Tetraeder   
XX YY ZZ SIGXX SIGYY SIGZZ TAUXY TAUYZ TAUZX SIGV
-9.16E-001 -1.34E+000 -1.55E+001 -2,35E+05 -6,12E+05 -8,47E+05 2,78E+04 -7,46E+05 4,61E+04 -7,46E+05
-9.16E-001 -1.01E+000 -1.61E+001 -2,33E+05 -8,71E+05 -6,66E+05 6,07E+04 -9,05E+05 5,59E+04 -9,05E+05
-1.12E+000 -9.70E-001 -1.56E+001 -2,20E+05 -5,31E+05 -7,59E+05 5,39E+04 -7,62E+05 6,65E+04 -7,62E+05
-1.25E+000 -1.01E+000 -1.61E+001 -1,54E+05 -7,90E+05 -6,28E+05 1,12E+05 -9,04E+05 7,31E+04 -9,04E+05
         
Element # = 2 Typ = 10-K Tetraeder   
XX YY ZZ SIGXX SIGYY SIGZZ TAUXY TAUYZ TAUZX SIGV
-9.55E-001 +2.81E+001 -9.37E+000 3,14E+03 5,59E+05 1,24E+05 -2,41E+02 -7,49E+05 -1,73E+02 -7,49E+05
-6.28E-001 +2.92E+001 -8.75E+000 -3,65E+03 5,15E+05 1,29E+05 3,89E+02 -7,36E+05 1,30E+02 -7,36E+05
-1.28E+000 +2.89E+001 -8.10E+000 -1,71E+03 4,73E+05 1,16E+05 4,57E+02 -7,40E+05 -1,42E+02 -7,40E+05
-2.02E+000 +2.89E+001 -9.18E+000 7,54E+02 5,45E+05 1,33E+05 4,16E+02 -7,42E+05 3,87E+00 -7,42E+05
         
Element # = 3 Typ = 10-K Tetraeder   
XX YY ZZ SIGXX SIGYY SIGZZ TAUXY TAUYZ TAUZX SIGV
-2.90E+000 -2.04E-002 -1.58E+001 -9,72E+04 -5,87E+04 -9,61E+04 2,05E+05 -9,02E+05 8,28E+03 -9,02E+05
-2.56E+000 -2.04E-002 -1.58E+001 -2,26E+05 -2,29E+05 -1,92E+05 3,36E+05 -7,29E+05 8,98E+03 -7,29E+05
-2.90E+000 -2.14E-001 -1.55E+001 4,81E+04 5,76E+04 -2,02E+05 7,35E+04 -1,07E+06 8,38E+03 -1,07E+06
-2.90E+000 +1.07E-001 -1.54E+001 1,24E+05 2,26E+05 3,94E+05 9,68E+04 -1,18E+06 -8,55E+03 -1,18E+06
         
Element # = 4 Typ = 10-K Tetraeder   
XX YY ZZ SIGXX SIGYY SIGZZ TAUXY TAUYZ TAUZX SIGV
-5.70E-001 -4.20E+000 +8.68E+000 1,66E+02 4,73E+04 2,15E+05 2,76E+02 -9,75E+05 -1,17E+03 -9,75E+05
-4.82E-001 -3.76E+000 +9.52E+000 -4,17E+03 4,11E+04 2,36E+05 3,81E+02 -9,69E+05 -1,37E+03 -9,69E+05
+5.35E-001 -3.96E+000 +9.13E+000 -6,01E+02 4,55E+04 2,25E+05 -1,36E+02 -9,71E+05 -8,91E+02 -9,71E+05
-8.30E-002 -4.61E+000 +9.36E+000 4,20E+02 7,36E+04 2,45E+05 -9,69E+02 -9,36E+05 -1,59E+03 -9,36E+05
 
It is the output from an FE program which is fine, but its graphical output is limited so I want to plot column 10 myself after some calculations with Octave. Therefore, I would need to delete empty rows and characters so that only the numbers remain. I will then have to find the z-coordinates in the layer of interest to me and then plot the stress over x and y coordinates in a kind of 2,5D plot. One dimension is x, the other is y and the third one is the stress, but this I want to plot as a color: high stress red, low stress green or so. I believe this is also called a heat map and can be achieved by pm3d command in Gnuplot for example.
 
First question: how do I extract the numbers only? I played around with fgetl but could not succeed.
Second question: how can I extract only those lines for which the z-coordinate (third column) has a value between, say, 0 and 0.05?
Third question: which plot command is the right one to use? I suppose it has something to do with a 3d map plot, that right?
Fourth question: how can I keep an empty row to separate the elements from each other? This is optional.
 
Thanks,
J-P

reply via email to

[Prev in Thread] Current Thread [Next in Thread]