Summary for: vtkwrite

VTKWRITE Writes 3D Matlab array into VTK file format. vtkwrite(filename,’structured_grid’,x,y,z,’vectors’,title,u,v,w) writes a structured 3D vector data into VTK file, with name specified by the string filename. (u,v,w) are the vector components at the points (x,y,z). x,y,z should be 3-D matrices like those generated by meshgrid, where point(ijk) is specified by x(i,j,k), y(i,j,k) and z(i,j,k). The matrices x,y,z,u,v,w must all be the same size and contain corrresponding position and vector component. The string title specifies the name of the vector field to be saved.

vtkwrite(filename,’structured_grid’,x,y,z,’scalars’,title,r) writes a 3D scalar data into VTK file whose name is specified by the string filename. r is the scalar value at the points (x,y,z). The matrices x,y,z,r must all be the same size and contain the corresponding position and scalar values.

vtkwrite(filename,’structured_grid’,x,y,z,’vectors’,title,u,v,w,’scalars’, title2,r) writes a 3D structured grid that contains both vector and scalar values. x,y,z,u,v,w,r must all be the same size and contain the corresponding positon, vector and scalar values.

vtkwrite(filename, ‘structured_points’, title, m) saves matrix m (could be 1D, 2D or 3D array) into vtk as structured points.

vtkwrite(filename, ‘structured_points’, title, m, ‘spacing’, sx, sy, sz) allows user to specify spacing. (default: 1, 1, 1). This is the aspect ratio of a single voxel.

vtkwrite(filename, ‘structured_points’, title, m, ‘origin’, ox, oy, oz) allows user to speicify origin of dataset. (default: 0, 0, 0).

vtkwrite(filename,’unstructured_grid’,x,y,z,’vectors’,title,u,v,w,’scalars’, title2,r) writes a 3D unstructured grid that contains both vector and scalar values. x,y,z,u,v,w,r must all be the same size and contain the corresponding positon, vector and scalar values.

vtkwrite(filename, ‘polydata’, ‘lines’, x, y, z) exports a 3D line where x,y,z are coordinates of the points that make the line. x, y, z are vectors containing the coordinates of points of the line, where point(n) is specified by x(n), y(n) and z(n).

vtkwrite(filename,’polydata’,’lines’,x,y,z,’Precision’,n) allows you to specify precision of the exported number up to n digits after decimal point. Default precision is 3 digits.

vtkwrite(filename,’polydata’,’triangle’,x,y,z,tri) exports a list of triangles where x,y,z are the coordinates of the points and tri is an m*3 matrix whose rows denote the points of the individual triangles.

vtkwrite(filename,’polydata’,’tetrahedron’,x,y,z,tetra) exports a list of tetrahedrons where x,y,z are the coordinates of the points and tetra is an m*4 matrix whose rows denote the points of individual tetrahedrons.

vtkwrite(‘execute’,’polydata’,’lines’,x,y,z) will save data with default filename ‘‘matlab_export.vtk’ and automatically loads data into ParaView.

Version 2.3 Copyright, Chaoyuan Yeh, 2016 Codes are modified from William Thielicke and David Gingras’s submission.

Default precision changed to 10 by Antti Lehikoinen, Smeklab Ltd, 2020.