accumarray error: Index into matrix must be positive

 Respuesta aceptada

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.

Categorías

Etiquetas

Preguntada:

el 4 de Abr. de 2016

Editada:

el 4 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by