Index in position 2 exceeds array bounds (c_null_model_udn_sign)

Submitted by CHL on


Dear all,

I get an error when using c_null_model_udn_sign to generate null models.

Index in position 2 exceeds array bounds (must not exceed 697).

The error happens when I create 1000 randomized subject data with  c_null_model_udn_sign.

If I create less randomized subject data, like 300 or 500, it works well.

Does anyone know how to solve the problem? It looks like that I need to edit the function, but I have no idea how to do it.

The following are details of my setting

Subject: 47 subjects divided into 2 groups, controls and patients.

CorrMatrix: 116 x 116 or smaller matrix (I thought the error may be due to the size of matrics, but both get the same problem)

Network Construction:

Threshold: Relative

Weight: no change

Generate 1000 randomized subject data (null model) with "c_null_model_udn_sign" (binary and weighted) and 1 interaction

Network Threshold: 0.1, 0.15, 0.2, 0.25, 0.3


Network Calculations:

(Both binary and weighted)

Betweenness centrality, cluster coefficient (global and local), characteristic path length (global and local), degree, and efficiency (global and local).

Click Use random network to calc smallworldness.


Raw Matrix:

Click Raw Matrix and "r to z"

Weights" no change



Between covariates: age, TIV

Between factors: group, gender


Graph matrics: permutation, 1000 times

Raw matrics: permutation, 1000 times


The error messages are:


Index in position 2 exceeds array bounds (must not exceed 697).


Error in CalcVars (line 779)

                        Result = ResultRandVar(:,i_rand);


Error in GraphVar_calc (line 93)

[res,shuffelFiles] =


'DoRandom',get(handles.RandomNetwork_check,'Value'), 'nRandom', dialogData.nRandom,

'RandomFunction' ,randomNetwork_func ,  'RandomIterations' , dialogData.randomIter,

'Smallworldness', get(handles.RandomNetwork_smallWorld,'Value'), 'randomForType',


dialogData.DynamicGraphVar,'n_multislice', dialogData.n_multislice,'n_alpha',



Error in GraphVar>Btn_calcCorr_Callback (line 73)

[res allTask] = GraphVar_calc(handles);      %%%%%%???????


Error in gui_mainfcn (line 95)



Error in GraphVar (line 40)

    gui_mainfcn(gui_State, varargin{:});


Error in>@(hObject,eventdata)GraphVar('Btn_calcCorr_Callback',hObject,eventdata,guidata(hObject))



Error while evaluating UIControl Callback.