paraview vtk文件乱码_Matlab处理数据导出Paraview可读的vtk文件(一)

这段代码提供了在Matlab中将数据写入VTK文件格式的函数`vtkwrite`,支持结构化网格、无结构网格、结构化点、线、三角形和四面体等数据类型。函数接受不同参数,如坐标、向量、标量等,允许用户指定文件名、精度、间距和原点。此外,还提供了自动加载数据到ParaView的功能。
摘要由CSDN通过智能技术生成

1 function vtkwrite( filename,dataType,varargin )2 %VTKWRITE Writes 3D Matlab array into VTK file format.3 % vtkwrite(filename,'structured_grid',x,y,z,'vectors',title,u,v,w) writes4 % a structured 3D vector data into VTK file, with name specified by the string

5 %filename. (u,v,w) are the vector components at the points (x,y,z). x,y,z6 % should be 3-D matrices like those generated by meshgrid, where

7 % point(ijk) isspecified by x(i,j,k), y(i,j,k) and z(i,j,k).8 %The matrices x,y,z,u,v,w must all be the same size and contain9 % corrresponding position and vector component. The stringtitle specifies10 %the name of the vector field to be saved.11 %

12 % vtkwrite(filename,'structured_grid',x,y,z,'scalars',title,r) writes a 3D13 % scalar data into VTK file whose name is specified by the string

14 % filename. r isthe scalar value at the points (x,y,z). The matrices15 %x,y,z,r must all be the same size and contain the corresponding position16 %and scalar values.17 %

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

23 % vtkwrite(filename, 'structured_points', title, m) saves matrix m (could24 % be 1D, 2D or 3D array) into vtk asstructured points.25 %

26 % vtkwrite(filename, 'structured_points', title, m, 'spacing', sx, sy, sz)27 % allows user to specify spacing. (default: 1, 1, 1). This isthe aspect28 %ratio of a single voxel.29 %

30 % vtkwrite(filename, 'structured_points', title, m, 'origin', ox, oy, oz)31 % allows user to speicify origin of dataset. (default: 0, 0, 0).32 %

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

38 % vtkwrite(filename, 'polydata', 'lines', x, y, z) exports a 3D line where

39 %x,y,z are coordinates of the points that make the line. x, y, z are40 % vectors containing the coordinates of points of the line, wherepo

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值