Message Boards Message Boards

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


(* 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 *)

POSTED BY: Anthony Kalinowski
4 months ago

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.

POSTED BY: John Hendrickson
4 months ago

Group Abstract Group Abstract