Read STL FILE on MATLAB

24 ビュー (過去 30 日間)
Huijuan Zhu
Huijuan Zhu 2020 年 12 月 30 日
回答済み: serhat YILDIZHAN 2021 年 6 月 19 日
Hello, I am doing my school project and have encountered this problem of reading STL file on MATLAB. The STL file has 7706 KB, i am trying to reduce the patch/mesh but I couldn't move on without reading the STL file on matlab first. Please help me out. Thank you very much.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 12 月 30 日
No, this is not how a function is called in MATLAB. Read here: https://www.mathworks.com/help/matlab/matlab_prog/create-functions-in-files.html. You cannot pass input when declaring the function. Which means that first line should be like this
function [coordinates] = stlread(filename)
..
..
fid = fopen(filename);
end
After declaring the function, you can call it like this
stlread('test.stl')
So your file should be like this
clear; % don't use clear all
clc;
coordinates = stlread('test.stl')
function [coordinates] = stlread(filename)
..
..
fid = fopen(filename);
end
and then run the script.
Note that from R2018b, MATLAB also have its own stlread() function. You can also use that.
  1 件のコメント
Huijuan Zhu
Huijuan Zhu 2020 年 12 月 30 日
Nicee, thank you very much, I will try that :)

サインインしてコメントする。

その他の回答 (1 件)

serhat YILDIZHAN
serhat YILDIZHAN 2021 年 6 月 19 日
hi, i want to open my stl file in axes1, but i am getting error. Can you help me?

カテゴリ

Help Center および File ExchangeSTL (STereoLithography) についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by