How to utilize nodes to plot a 3D object?

5 次查看(过去 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.

回答(1 个)

kowshik Thopalli
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.

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by