Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to fill the surface in 3D..?

Asked by Lalit Patil on 7 Dec 2012

http://speedy.sh/PFFhn/N3d.txt

I have this 3D data file, and i am creating a 3D of it using,

.................................................

fileID = fopen('N3d.txt');

C = textscan(fileID, '%f %f %f');

fclose(fileID);

x=cell2mat(C(:,1));

y=cell2mat(C(:,2));

z=cell2mat(C(:,3));

patch(x,z,y,'R')

view(3)

axis equal off tight vis3d; camzoom(1.2)

colormap(spring)

rotate3d on

...............................................

And it gives 3D image, now i want to see what the actual object it is..?

So, for this i will require to fill that surface,

so, how to do.?

1 Comment

Jan Simon on 7 Dec 2012

What's wrong with properly formatted code? It is such a helpful feature that I cannot understand, why users in this forum do not want to use it.

Lalit Patil

Products

No products are associated with this question.

1 Answer

Answer by Jan Simon on 7 Dec 2012
Edited by Jan Simon on 7 Dec 2012

Filling a surface plot means using non-transparent and colored patch faces. See the properties of patch(), especially the 'FaceColor'.

Reading the documentation of a command is usually more efficient to ask in the forum and get the answer, that the documentation contains enough information and rephrasing them would be less efficient.

4 Comments

Lalit Patil on 7 Dec 2012

P = patch(x,z,y, [0.5 0.5 0.5],'EdgeAlpha',0,'FaceAlpha',1);

hold on

I tried this but even if it is not a satisfactory result..

Jan Simon on 9 Dec 2012

@Lalit Patil: 1. The linked picture contains three different views of one object. 2. patch() is a built-in function. Why do you think, that it uses an isosurface function, what does this detail mean and how is this connected to the question? 3. Please do not post "it shows an error" with out showing the code and a copy of the error message. How could we suggest an improvement without knowing any detail? 4. "not a satisfactory result" does not explain anything also: Can I guess what is satisfying for you? 5. Did you consider to use surf instead of patch? Look at the examples in doc surf.

Why do you decide not to format the code in your question or in the comments?

Lalit Patil on 14 Dec 2012

http://speedy.sh/JVWrY/N3d.txt

This is my text file to create 3d.. I am creating 3d of it using above code and it creates, now i want to fill this 3d image with some material so it looks like filled and smooth and one can identify an object..

The picture i posted in link is the example of filled object..

No, i am not thinking to use surf..

Format code has been solved..

Jan Simon

Contact us