フィルターのクリア

Creating an array for each neighbor of a node in graph

1 回表示 (過去 30 日間)
Isaac Osei Agyemang
Isaac Osei Agyemang 2018 年 10 月 17 日
Hi community, i want to create an array or a table for each neighbor of a node. In the sample of code give, the neighbors of a certain random node is what is in the variable 'acnode , so i want to create an array for each variable in 'acnode'. So i want new arrays in the form 'node' plus the name of the neighbor, example: node1322 = [], node1416 = [], node1845 = [].
nodepos = randi(length(1:nodesize));
rnode = (nodepos)
node_ngb = neighbors(G, rnode)
acnode = [];
for i = 1:length(node_ngb)
acnode = node_ngb(1:i);
end
acnode
acnode =
1322
1416
1845

回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by