read and write CAD Data files using matlab (DX format)

read and write CAD data in a DX format

이 제출물을 팔로우합니다

CAD data files in a DX format are a straightforward and useful way to interpret and communicate 3D data among programs. This pair of programs reads and writes these files to allow users to interface matlab code with such programs.

-- example usage: output a spherical gradient 10 angstroms in radius --

[X Y Z] = meshgrid(-10:10); % make a 3D gradient
input.densityMatrix = ((X.^2 + Y.^2 + Z.^2).^0.5); % construct 3D space
isosurface(input.densityMatrix); % plot in matlab
mat2dx(input); % output as DX file

-- example usage: normalize DX output --

DXdata = dx2mat('DXfile.dx'); % interpret DX data
mat3D = DXdata.densityMatrix; % make name convenient
maxValue = max(max(max(mat3D))); % find max value
minValue = min(min(min(mat3D))); % find min value
valueRange = maxValue - minValue; % find range of data
DXdata.densityMatrix = (mat3D-minValue)/valueRange; % normalize and save
DXdata.outfile = 'DXfile_normaized.dx'; % rename output
mat2dx(DXdata); % write to DX file

%% -- mat2dx.m --
%
% this function outputs a DX file for viewing in programs such as VMD or PyMOL. It uses
% six inputs to function properly (subvariables of "DXdata"). While only
% one is necessary (the 3D matrix called "densityMatrix"), the others shape
% and position the 3D matrix in space. A minimum point and a voxel length
% are required to do this. The minimum point is recorded as the "minX"
% "minY" and "minZ" variables.
% As of July 2012, file output format is as defined on
% http://www.poissonboltzmann.org/file-formats/mesh-and-data-formats/opendx-scalar-data

%% -- dx2mat.m --
%
% this function reads in a DX file and translates it into a 3D matrix in
% matlab. DX files are file formats for storing 3D data in plaintext, and
% they are readable by PyMOL and VMD. One inputs the DX file path, and the
% program outputs a structure with all the information about the DX

인용 양식

Evan (2026). read and write CAD Data files using matlab (DX format) (https://kr.mathworks.com/matlabcentral/fileexchange/42958-read-and-write-cad-data-files-using-matlab-dx-format), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Model Import에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0