Message Boards Message Boards


Export a Nx2 array data file that generated a u[x,] vs x line plot?

Posted 9 months ago
1 Reply
1 Total Likes

(* suppose a finite element run generated a solution u[x,y] with the \ command listed below*)

ufun = NDSolveValue[{op == 
     Subscript[\[CapitalGamma], N1] + Subscript[\[CapitalGamma], N2] +
       Subscript[\[CapitalGamma], N3], Subscript[\[CapitalGamma], D]},
    u, {x, y} \[Element] mesh];

(* and suppose at constant value y=ycon, the command below \ sucessfully plots the solution u[x,ycon] vs x *)

Plot[Re[ufun[x, ycon]], {x, xlow, xhigh}, PlotLabel -> "ycon=0 Real u vs x " ]  


HOW TO EXPORT THE u[x,ycon] vs x PLOTTED CURVE AS A SIMPLE Nx2 two \ column data FILE *)

there are many Export[] types

you might try exporting the data as 3D data - which will give you columns of values. then maybe use awk(1) or printf(1) after to clean it up. the graphic data may be stored. say x is a graphic, then x[[1]] has a structure (see the Structure of Graphics in the Mathematica book). with that you could generate an array and write it to disk the usual way >>

probably you want to use Export (type lines or something) on the Graphics[] data portion of x will work

You may need to apply Normal[x] first (for some Mathematica plots there is no graphics data unless requested), and in some cases even Normal will not yield a result: in which case your left to DiY.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract