Want to plot a mesh structure in matlab but in live script this error comes up.

1 ビュー (過去 30 日間)
Shivam Dave
Shivam Dave 2021 年 4 月 21 日
回答済み: Chidvi Modala 2021 年 6 月 3 日
This is the code section
stlFile = 'Lift_Arm_New_2.stl';
figure
trisurf(stlread(stlFile))
axis equal
Getting this error:
Index exceeds the number of array elements (0).
Error in trisurf (line 78)
x = varargin{1};

回答 (1 件)

Chidvi Modala
Chidvi Modala 2021 年 6 月 3 日
The triangulation object returned from stlread(stlFile) might be empty. Hence the error.
You may verify this by executing the following code
stlFile = 'Lift_Arm_New_2.stl';
TR = stlread(stlFile);
And check if the workspace variable TR is empty.

Community Treasure Hunt

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

Start Hunting!

Translated by