FE triangle mesh without the mesh node connections visible
4 views (last 30 days)
Show older comments
I have the following code to generate image results from my .txt file:
It works, but I want to not show the mesh node connections in the plots WITHOUT using the scatter function. The pictures should remain the same without the black line connections. How do i realize this?
clc
close all
clear
% Read the data from the TXT file
fileID = fopen('2D_brain_1_object_src8_det8_simple_inv_inv_final.txt', 'r');
headerLines = 2; % Starting header lines
header = textscan(fileID, '%s', headerLines, 'Delimiter', '\n');
fclose(fileID);
% Extract the value after E=
N_value = str2double(strsplit(header{1}{2}, {'N=', ' '}));
nan_columns = any(isnan(N_value), 1);
N_value(:, nan_columns) = [];
num_coordinates_lines = N_value; % Number of lines for coordinates and properties
% Read the coordinates and properties data
fileID = fopen('2D_brain_1_object_src8_det8_simple_inv_inv_final.txt', 'r');
data = textscan(fileID, '%f%f%f%f%f%f', num_coordinates_lines, 'HeaderLines', headerLines);
fclose(fileID);
X = data{1};
Y = data{2};
Z = data{3};
permittivity = data{5};
conductivity = data{6};
% Read the mesh connections separately using textscan
fileID = fopen('2D_brain_1_object_src8_det8_simple_inv_inv_final.txt', 'r');
meshData = textscan(fileID, '%d%d%d', 'HeaderLines', headerLines + num_coordinates_lines);
fclose(fileID);
% Extract mesh connections
node1 = meshData{1};
node2 = meshData{2};
node3 = meshData{3};
% Create mesh connections matrix
meshConnections = [node1, node2, node3];
% Plotting the mesh based on permittivity levels
figure;
subplot(1, 2, 1);
h1 = trisurf(meshConnections, X, Y, Z, permittivity);
colorbar;
title('Mesh with Permittivity Levels');
xlabel('X [$m$]');
ylabel('Y [$m$]');
zlabel('Z [$m$]');
view(2); % Set view to 2D (X-Y plane)
axis equal
% Plotting the mesh based on conductivity levels
subplot(1, 2, 2);
h2 = trisurf(meshConnections, X, Y, Z, conductivity);
colorbar;
title('Mesh with Conductivity Levels');
xlabel('X [$m$]');
ylabel('Y [$m$]');
zlabel('Z [$m$]');
view(2); % Set view to 2D (X-Y plane)
axis equal
1 Comment
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!