フィルターのクリア

Help with neighbor function - inconsistent node connections

2 ビュー (過去 30 日間)
Shemin Sagaria
Shemin Sagaria 2022 年 8 月 9 日
回答済み: Walter Roberson 2022 年 8 月 9 日
Good day everyone,
I need help with the fuction - neighbor in Simulink/MATLAB. During each time step, the choosen node changes in the model and thus the number of neighbour connection to the node; sometimes its 3 and sometimes its 2 or 1. But MATLAB shows this as an error. I am using MATLAB 2021a. I hope some expericed member in the community can help me with this.
Error:
Size mismatch for MATLAB expression '<output of neighbors>'. Expected = 3x1 Actual = 2x1

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 8 月 9 日
MaxNeigh = 3;
neigh = zeros(MaxNeigh,1);
coder.varsize('neigh', [MaxNeigh 1], [1 0]); %second dimension is fixed
neigh = neighbors(G);

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by