フィルターのクリア

wrinting a ".str" file

3 ビュー (過去 30 日間)
Win Thomas Halim
Win Thomas Halim 2011 年 4 月 27 日
hi there, just want to ask u a simple question here, so suppose i have x y and z matrix which i want to convert into a stream file. they consist of 100x1 data each. what matlab command do i need to use to convert them into a ".str" attribute and how do i use it? thank you very much

回答 (1 件)

Alexandre Carvalho Leite
Alexandre Carvalho Leite 2011 年 4 月 27 日
Write your data into a file, just like in the following function:
function [] = surf2obj(fileName,x,y,z)
%
% SURF2OBJ converts a surface into an OBJ file.
%
% SURF2OBJ(fname,X,Y,Z) where fname is the filename (without extension)
% used to generate the dxf file and X, Y and Z are matrix arguments
% of the MATLAB surface format.
%
% Example: Classical peak plots:
%
% [X,Y,Z] = peaks(3);
% surf2obj('sd.obj',X,Y,Z); % search the file sd.obj at the current MATLAB path
%
%
% Author: Alexandre Carvalho Leite (alexandrecvl@hotmail.com)
%
p=surf2patch(surf(x,y,z));
fid=fopen(fileName,'w+');
for v=1:size(p.vertices,1),
fprintf(fid,'v %f %f %f\n',p.vertices(v,1),p.vertices(v,2),p.vertices(v,3));
end
fprintf(fid,'\n');
for f=1:size(p.faces,1),
fprintf(fid,'f %d %d %d %d\n',p.faces(f,1),p.faces(f,2),p.faces(f,3),p.faces(f,4));
end
fclose(fid);
  1 件のコメント
Win Thomas Halim
Win Thomas Halim 2011 年 5 月 4 日
do i need to download surf2obj function? if yes where can i find it? i cant find it in the file exchange.
im new at matlab, sorry for this question.
thank you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by