Error in Calculate variables and export: Matrix should be undirected

Submitted by toronto on

Hi, 

I got the following errors during running "Calculate variables and export". I would appreciate if you could help me fix these errors.

??? Error using ==> randomizer_bin_und at 31
Matrix should be undirected
 
Error in ==> CalcVars at 426
                                ResultRand{i_sub,i_random,i_dyn} =
                                randFuncHandle(VPData{i_sub,i_dyn},randomIterations);
 
Error in ==> GraphVar_calc at 85
[res,shuffelFiles] =
CalcVars(dialogData.thresholds,dialogData.thresholdType,dialogData.brainD,dialogData.functionList,handles.vpFiles,'TaskPlaner',allTasks,'MatrixName',dialogData.MatrixName,'FilePo
Error in ==> GraphVar_CalcExport_Callback at 42
[res allTasks] = GraphVar_calc(handles,1);
 
Error in ==> gui_mainfcn at 96
        feval(varargin{:});
 
Error in ==> GraphVar at 40
    gui_mainfcn(gui_State, varargin{:});
 
Error in ==>
@(hObject,eventdata)GraphVar('GraphVar_CalcExport_Callback',hObject,eventdata,guidata(hObject))
 
 
??? Error while evaluating uicontrol Callback
 
>> 
Thanks for your time.
 
 

Johann Kruschwitz

Wed, 09/02/2015 - 15:46

Hi,
it seems as if your matrix is not symmetric and thus directed. GraphVar currently only works with undirected networks and so does the BCT randomization function you want to use. So please make sure that there are exactly the same values above and under the diagonal (sometimes programs and other functions produce rounding errors some digits after the comma). 

 In General to this problem - GraphVar works like this: it will take your subject´s matrix and perform the thresholding (if you do proportional thresholding, the first check for symmetry is already done in BCT´s “threshold_proportional”). Depending on your graph metric choice (this should be a binary function/metric if you want to use the  “randomizer_bin_und”) , GraphVar will set the network to binary/(weighted). Subsequently, the thresholded binarized matrix is handed over to the “randomizer_bin_und” function and the random network is generated. So if there is an error that explicitly says (as you posted) “Matrix should be undirected” resulting the “randomizer_bin_und” function, the thresholding function already appears to detect the matrix as directed.

Here is what I would do/suggest to test your matrices:

·         Define your matrix as W

·         isequal(W,W.') (tests for symmetry; 0 denotes not symmetric, 1 denotes symmetric)

·         W==W’ (will give you a matrix comparing the upper and lower part of your matrix: 1 denotes same entry; 0 denotes differences)

·         [row,col] = find(W~=W') (will give you the exact position were differences occur)

·         W(W~=W') (will give you these values from W)

With DPARSFA I have had the experience that sometimes there are for some reasons rounding problems during generation of the correlation matrix which are not visually detectable (problem wrt symmetry: DPARSFA calculates each single cell in the matrix and not simply mirrors the upper half - I think). To make it work I would suggest to use DPARSFA to extract the time courses (ROI Signals) of your nodes and subsequently generate the connectivity matrix with GraphVar (here we mirror the values). 

Forums