Filter löschen
Filter löschen

write node to cell center

3 Ansichten (letzte 30 Tage)
vaya putra
vaya putra am 12 Jul. 2019
Beantwortet: KSSV am 12 Jul. 2019
i have 72 node ( 1, ...,72 )
each node have a value between 0-1
i want calculate average each node become 1 cell
i know the coordinate (geometry ) of my cell and node
how to make it simple without manual input
  4 Kommentare
KSSV
KSSV am 12 Jul. 2019
You can use mean right?
vaya putra
vaya putra am 12 Jul. 2019
for 25 cell its okay
but next i have 1000 cells, so its impossible if by manual input. this is using VTK Unstructurd grid

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 12 Jul. 2019
I got the problem..I think you want to do the following.
A = xlsread('NODETOSELL.csv') ; % read the file
node_vals = A(:,3) ; % node values
cells = A(:,7) ; % cells
nodes = A(:,8:15) ; % respective nodes in cells
% Remove the nans
cells(isnan(cells(:,1)),:) = [] ; % remove the nans in the cells (this is due to your file pattern)
nodes(isnan(nodes(:,1)),:) = [] ; % remove the nans in the cells (this is due to your file pattern)
% GEt the average
N = length(cells) ;
iwant = zeros(N,1) ;
for i = 1:N
iwant(i) = mean(node_vals(nodes(i,:)+1)) ; % i is added because, node has 0, and MATLAB index starts with 1
end

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by