![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/179727/image.jpeg)
How to utilize nodes to plot a 3D object?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi there. I am making a script that will load nodes from a .dat file, and plot out the values to make the shape of a 3D object.
Here is my current script:
clear
clc
load('F15.dat', 'node')
node = struct('ID', 0, 'fn', 0, 'sn', 0, 'tn', 0);
node.ID = 1;
node.fn = 0;
node.sn = 0;
node.tn = 0;
node = [n;3];
face = struct('ID', 0, 'fn', 0, 'sn', 0, 'tn', 0);
face.ID = 1;
face.fn = 0;
face.sn = 0;
face.tn = 0;
face = [n;3]
patch('Faces', F, 'Vertices', V, ...
'FaceColor', [1 1 0], ...
'FaceLighting', 'gouraud', ...
'FaceAlpha', 1, ...
'EdgeColor', 'none', ...
'EdgeLighting', 'gouraud', ...
'EdgeAlpha', 1, ...
'AmbientStrength', 0.3);
camlight headlight
material shiny
axis image
axis off
view(50,20);
It is also said that I need to store the three coordinates of all nodes, and their IDs, in two separate matrixes with a parameter of [n * 3]. The .dat file has the node, face, and bar values, but I only need to use the nodes and face types.
This is what I have so far, but I am getting an error that says the first text in the .dat file is unknown and can't be used. Can anyone help? Here is also an attached excerpt regarding the storing of data in the matrix.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170481/image.png)
0 件のコメント
回答 (1 件)
kowshik Thopalli
2017 年 11 月 30 日
Ok. I have attached the script to do this. You are reading the data wrong. I have also attached the image. Hope this helps.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/179727/image.jpeg)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!