Monday, November 11, 2013

Exporting an STL from Matlab

In this tutorial, you will learn a simple way to export a 3D image as an STL by using Matlab. The functions you'll need to make the STL file in Matlab can be found in the 1st and 2nd link below, while a more in depth tutorial can be found in the 3rd link.

LINKS:

Okay: so let's get to it.

1. Save the above two functions into Matlab.

2. Make a 3D surface plot in Matlab.
For example, type in:
    >>  [X,Y] = meshgrid(-8,0.1:8); 
    >>  R = sqrt(X.^2+Y.^2) + eps;
    >>  Z = sin(R)./R;                  
    >>  surf(X,Y,Z)                      

3. Use the surf2solid function which you downloaded earlier:
    >> VariableName = surf2solid(X,Y,Z);

4. Use the stlwrite function that you downloaded:
    >> stlwrite('FileName.stl',VariableName)  
*FileName is to be replaced with what you want to name your file

And there you have it, a nice simple way of exporting a 3D file from Matlab. 

11 comments:

  1. Hi,

    It showed an error stating Z should be a matrix not a vector/scalar quantity

    ReplyDelete
  2. Theres an error in code should be -
    >> [X,Y] = meshgrid(-8:0.1:8);
    >> R = sqrt(X.^2+Y.^2) + eps;
    >> Z = sin(R)./R;
    >> surf(X,Y,Z)

    ReplyDelete
  3. Very nice blog...
    Great information provided. We also provide Matlab Training in Noida. I appreciate your work.

    ReplyDelete
  4. Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
    Matlab Training in Chennai

    ReplyDelete
  5. Online mba in India
    DEIEDU is the best online Institute in the world with high class course outline and up to date learning materials. DEIEDU is providing the online mba in india, online mba in india, Distance learning mba courses in india, Correspondence mba in India Mba from distance in India, Online Executive Mba in India, distance Mba from India, Online distance mba in India. Distance learning mba degree in India.
    Address:
    401, fourth floor sg alpha tower
    Vashundhra (up)
    Phone: 9811210788
    Email: info@deiedu.in
    Website: http://www.deiedu.in/
    online mba in india

    ReplyDelete
  6. Global 3D Labs the best and safest to buy 3D printers in India. We manufacture a wide range of best-in-class 3D printers and 3D printing service providers in India

    ReplyDelete
  7. Anexas is the best institute for six sigma certification in Bangalore that offers an internationally-recognized six sigma green belt training and certification program. It is kpmg approved six sigma training coaching center in Bangalore. This lean six sigma green belt certification course in Bangalore is ideal for individuals and enterprises that are looking to gain an in-depth understanding and ensure that you clear lean six sigma green belt certification exam in your first attempt.

    https://www.anexas.net/six-sigma-training/six-sigma-certification-bangalore

    ReplyDelete
  8. I prefer to study this kind of material. Nicely written information in this post, the quality of content is fine and the conclusion is lovely. Things are very open and intensely clear explanation of issues
    Best software Training institute in Bangalore

    ReplyDelete