Check for incorrect argument data type or missing argument in call to function 'neighbors'.

25 views (last 30 days)
Omer Iqbal
Omer Iqbal on 9 Jan 2022
Commented: Cris LaPierre on 12 Jan 2022
Hi! I am having an error on the following functions. I have all the inputs but the fucntion is still not able to read it.Please see the snapshot
j=1;
for i=1:numel(M_nodes_idx)
% disp(i)
current_node = M_nodes_idx(i,1);
if neighbors(current_node,g)~=current_node
n1n2 = neighbors(g,current_node);
  2 Comments
Omer Iqbal
Omer Iqbal on 9 Jan 2022
Th value of current mode is 1, while g has all edges and nodes. I am trying to understand the problem through debuding but the problem does not seems to be clear becasue I have all the inputs and the fucntion should be working.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 11 Jan 2022
@Star Strider had what I thought was the correct answer. In your if statement, you reverse the order of your inputs to neighbors.
g should be your graph object (e.g. g = graph(bucky);), which we can't see, so check that, and nodeID should be a single node (e.g. current_node)
% v This should be the first input to neighbors
if neighbors(current_node,g)~=current_node
n1n2 = neighbors(g,current_node);
Try correcting the order of your inputs.
if neighbors(g,current_node)~=current_node
n1n2 = neighbors(g,current_node);
  2 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!