First of all the output of 'find_nbrs' is a row vector. I get the following error (Subscript indices must either be real positive integers or logicals.) at line 13 when evaluating the following code:
function [ N ] = componentt( A,m,found_list )
found_list=[m];
for i = find_nbrs(m,A)
found_list(length(found_list)+1)=i;
end
v=[];
for j=found_list
v=[v find_nbrs(j,A)];
end
v=unique(v);
while length(v)~= length(found_list)
found_list = [found_list v(end)];
for k=v
a=find_nbrs(k,A);
while ~ismember(a,found_list)
v(length(v)+1)=a;
end
end
end
N=sort(found_list); %The entries of the output vector are in increasing order.
end