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

버전 1.0.0.0 (4.75 KB) 작성자: Evan
read and write CAD data in a DX format
다운로드 수: 1.2K
업데이트 날짜: 2013/8/5

라이선스 보기

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 (2025). 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. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Model Import에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0