reshape error in an .stl writer?

So i've used an function, stlread, to import an .stl files information (faces, vertices, and normals) into matlab and am now trying to export them as an .stl. The problem is that the function I'm using to take the faces and vertices and write them to an stl file has this line of code: facets = reshape(facets(:,ceil(faces)'), 3, 3, []); which doesn't like that faces is an array of non integers. However, that's the array that the .stl reader outputs. Here's the stl reader: http://www.mathworks.com/matlabcentral/fileexchange/6678-stlread and here's the .stl writer: http://www.mathworks.com/matlabcentral/fileexchange/20922-stlwrite-write-binary-or-ascii-stl-file and help is greatly appreciated! Thank you very much!

1 commentaire

Jan
Jan le 4 Mar 2015
Please explain, why you assume that the program "doesn't like that faces is an array of non integers".

Connectez-vous pour commenter.

Réponses (1)

DGM
DGM le 2 Avr 2025
Modifié(e) : DGM le 2 Avr 2025

0 votes

There are many files called "stlread()", but FEX #6678 stlread() does not return face/vertex data. It combines the FV data and returns direct xyz lists. When you use it, you're throwing away all your face/vertex lists. You might be able to reassemble everything into face and vertex lists, but it would be a waste of time. Don't use it if you don't want it formatted that way.

Modifié(e) :

DGM
le 2 Avr 2025

Community Treasure Hunt

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

Start Hunting!

Translated by