フィルターのクリア

accumarray error: Index into matrix must be positive

2 ビュー (過去 30 日間)
Jack Ie
Jack Ie 2016 年 4 月 4 日
編集済み: Walter Roberson 2016 年 4 月 4 日
G=[0 1 ; 0 2 ; 1 2];
adj=accumarray(G,1,[],[],0,true);
error: Index into matrix must be positive.

採用された回答

Star Strider
Star Strider 2016 年 4 月 4 日
What I do in situations such as yours is to add 1 to the minimum value (here 0) of the index array:
G=[0 1 ; 0 2 ; 1 2];
adj=accumarray(G+1,1,[],[],0,true);
That solves the immediate problem. You can make adjustments in other parts of your code afterwards.

その他の回答 (2 件)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016 年 4 月 4 日

Chad Greene
Chad Greene 2016 年 4 月 4 日
The zeros in G are not positive.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by