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

4 Ansichten (letzte 30 Tage)
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 Kommentare
Rik
Rik am 8 Okt. 2020
What program were you planning to use the .obj file in?
alihan saglam
alihan saglam am 14 Okt. 2020
Blender. By the way I am not good at matlab. So should I copy/paste the code for export as .obj?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Pratheek Punchathody
Pratheek Punchathody am 20 Okt. 2020
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 Kommentar
alihan saglam
alihan saglam am 20 Okt. 2020
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by