FE triangle mesh without the mesh node connections visible

조회 수: 2 (최근 30일)
Lara
Lara 2023년 12월 14일
댓글: Lara 2023년 12월 18일
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
Avni Agrawal
Avni Agrawal 2023년 12월 18일
Hi, can you please attach the imported files for better debugging?

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2023년 12월 18일
h1 = trisurf(meshConnections, X, Y, Z, permittivity);
h1.EdgeColor = 'none' ;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Display Point Clouds에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by