function [node,distance,inside_nodes]=findnodedistances(centre,radius,nodeFile)

%[node,distance,inside]=findnodedistances(centre,radius,nodeFile)
%
%The function finds the distance between the centre of a sphere and every
%node in the nodeFile and determines whether the node is within the sphere

nodePositions = table2array(readtable(nodeFile));


node = nodePositions(:,1);

p = nodePositions(:,2:4);
size(p)
c = centre;
size(c)

distance = sqrt( (c(1)-p(:,1)).^2+(c(2)-p(:,2)).^2+(c(3)-p(:,3)).^2);

inside = (distance<radius);

inside_nodes=node(inside);