How do I export XYZ data from CreateMesh? I am exporting data from a Mathcad Prime 3D surface plot to a graphics program which will allow me to color code the surface based upon the Z values.
Solved! Go to Solution.
The data structure suggested by Terry can be easily created in Prime and then exported to Excel in one go:
And you may even create the plot in Excel but it would need some more additional work to have it using a better color scheme and more meaningful scales.
Which data structure is needed by the external graphics program?
CreateMesh creates a nested matrix. Its a 3 x 1 matrix and the elements are n x m matrices with the x, y and z values of the surface points. Furthermore this structure also defines automatically the quadrilateral "patches" the surface consists of.
It would be easy to write a small program to export a 3-column matrix with n * m elements consisting of all the points of the surface, but how would an external program know which four points create a side face of the surface?
So once you know the data structure needed for your external program, it may be possible to write a Mathcad program to create and export that structure.
I guess most programs won't understand the structure READPRN creates
Real Mathcad of course does:
Real Mathcad even makes a good job if only provided a simple linear point list without any information about side faces.
In Prime:
In Mathcad
But again - you'll have to know which data structure your external program needs.
Hi,
Export the three nested matrices in M as separate Excel files.
Most graphical packages can handle Excel files.
For example ORIGIN with a simple rearrangement in Excel gets this:
Cheers
Terry
The data structure suggested by Terry can be easily created in Prime and then exported to Excel in one go:
And you may even create the plot in Excel but it would need some more additional work to have it using a better color scheme and more meaningful scales.
Werner,
Please explain the matrix operators which have vertical and horizontal parenthesis. Thanks!
Glen
@gatlas wrote:
Werner,
Please explain the matrix operators which have vertical and horizontal parenthesis. Thanks!
Glen
What you are referring to are the matrix row- and column selectors.
Here is in a bit more detail explained what I did:
So, if the program you use for plotting expects that kind of data table and if it can read Excel (which is very likely) this should help.
Prime 6 sheet attached
I added a function which directly creates that data structure from a given function R x R -> R without the need to call CreateMesh and alter its output data.
Syntax is similar to that of CreateMesh.
BTW, the reason for the crude X and Y values is because the last two (optional) arguments of CreateMesh are the number of data values, NOT the number of intervals.
So if x runs from 10 to 30 and you ask for 10 data values you are asking for just 9 intervals. So the first value is 10 and the second is 10+(30-10)/9=12.222.... So ist probably better to ask for 11 data values to get the series 10, 12, 14, ...30.
P6 sheet attached