フィルターのクリア

Unable to use a value of type graph as an index.

19 ビュー (過去 30 日間)
Omer Iqbal
Omer Iqbal 2022 年 2 月 10 日
コメント済み: Cris LaPierre 2022 年 2 月 10 日
Hi!
I am getting the error in below codes. I have all the inputs in workspace but I am still getting this error. Can anybody help me to resolve this error? Please find the screeshot of an error in an attachment.
for i=1:m
current_node = neigh_nodes_deg_2(i,1);
preceding_node = origin_node;
edge_path = [origin_node;current_node];
counter = 1;
% note: if the graph contains a closed sub-graph, the while loop will
% not end. Stop, identify the loop and correct it within the
% shapefile
while isempty(neigh_nodes_deg_2(G2,current_node,preceding_node))~=1
succeeding_node = niegh_nodes_deg_2(G2,current_node,preceding_node);
preceding_node = current_node;
current_node = succeeding_node;
edge_path = [edge_path; current_node];
counter = counter + 1;
end

回答 (1 件)

Cris LaPierre
Cris LaPierre 2022 年 2 月 10 日
Your variable G2 is a graph obejct, but you are using it to index the first position (rows) of neigh_nodes_deg_2, which is a vector.
% vv Here
while isempty(neigh_nodes_deg_2(G2,current_node,preceding_node))~=1
  2 件のコメント
Omer Iqbal
Omer Iqbal 2022 年 2 月 10 日
Hi!
Thanks for your suggestions. Did you mean to change the order of variable is the solution? For instance, see below;
while isempty(neigh_nodes_deg_2(current_node,G2, preceding_node))~=1
However, it is still giving me an error by re arrangment of variables.
Cris LaPierre
Cris LaPierre 2022 年 2 月 10 日
You cannot use G2 as an index at all, It is not the value you think it is. Here is an example of the error.
A=1:3;
p=plot(A);
% your error
A(p)
Unable to use a value of type matlab.graphics.chart.primitive.Line as an index.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by