Change scale in stl text mesh file
Version 1.0.0 (1.13 KB) by
JCBod Bodoque
Reads an stl flie in text format, and applies an scale factor called factor.
fid=fopen('originalfiletxt.stl');
fid2=fopen('modfile.stl','w');
factor=1000;
while ~feof(fid)
tline = fgetl(fid);
disp(tline);
if(strfind(tline,'vertex')==1)
A=sscanf(tline,'%s %f %f %f');
fprintf(fid2,'%s %.14f %.14f %.14f\n','vertex',A(7)*factor,A(8)*factor,A(9)*factor);
else
fprintf(fid2,'%s\n',tline);
end
end
fclose(fid);
fclose(fid2);
Cite As
JCBod Bodoque (2026). Change scale in stl text mesh file (https://www.mathworks.com/matlabcentral/fileexchange/69082-change-scale-in-stl-text-mesh-file), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2018b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Data Import and Analysis > Data Import and Export > Standard File Formats > STL (STereoLithography) >
Find more on STL (STereoLithography) in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
