I have a .fig file and can I export it to the .obj file?

조회 수: 7 (최근 30일)
alihan saglam
alihan saglam 2020년 10월 7일
댓글: alihan saglam 2020년 10월 20일
Hello I have a code
x = gallery('uniformdata',30,1,1);
y = gallery('uniformdata',30,1,10);
plot(x,y,'.')
axis([-0.2 1.2 -0.2 1.2])
axis equal
k = boundary(x,y);
hold on
plot(x(k),y(k))
hold off
k0 = boundary(x,y,0);
k1 = boundary(x,y,1);
hold on
plot(x(k0),y(k0))
plot(x(k1),y(k1))
hold off
legend('Original points','Shrink factor: 0.5 (default)',...
'Shrink factor: 0','Shrink factor: 1')
P = gallery('uniformdata',30,3,5);
plot3(P(:,1),P(:,2),P(:,3),'.','MarkerSize',10)
grid on
k = boundary(P);
hold on
trisurf(k,P(:,1),P(:,2),P(:,3),'Facecolor','red','FaceAlpha',0.1)
hold off
[r,g,b] = meshgrid(linspace(0,1,50));
rgb = [r(:), g(:), b(:)];
lab = rgb2lab(rgb);
a = lab(:,2);
b = lab(:,3);
L = lab(:,1);
k = boundary(a,b,L);
trisurf(k,a,b,L,'FaceColor','interp',...
'FaceVertexCData',rgb,'EdgeColor','none')
xlabel('a*')
ylabel('b*')
zlabel('L*')
axis([-110 110 -110 110 0 100])
view(-10,35)
axis equal
title('sRGB gamut surface in L*a*b* space')
and it generates surface. But the problem that I can not export it as .obj file. Any suggestions?
  댓글 수: 2
Rik
Rik 2020년 10월 8일
What program were you planning to use the .obj file in?
alihan saglam
alihan saglam 2020년 10월 14일
Blender. By the way I am not good at matlab. So should I copy/paste the code for export as .obj?

댓글을 달려면 로그인하십시오.

채택된 답변

Pratheek Punchathody
Pratheek Punchathody 2020년 10월 20일
Exporting 3D graphics from MATLAB to the .OBJ file format is not directly supported. The concerned people are aware of this and might consider implementing it in any future release.
However, there is a third-party library Wavefront OBJ toolbox which has a function write_wobj(OBJ,filename);” that can export 3D figure as an .obj file.
This is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement. Feel free to contact the author of this submission directly for specific questions about the implementation".
As a workaround, OBJ file is basically a space separated text file, hence it should be possible to write and read .obj file as a table.
Hope this helps.
  댓글 수: 1
alihan saglam
alihan saglam 2020년 10월 20일
Thank you for your response. I checked that link in the past but I could not do it. Is there any opportunity to help me to write the code? Regards, Han

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by