为什么此代码会关闭Windows系统?

时间:2017-06-20 05:35:47

标签: matlab adjacency-matrix symmetric

我使用以下代码从未加权和无向图中获取对称邻接矩阵。一旦我运行它,Windows系统直接关闭

fidneighb2= fopen('neighborfile2.txt','rt'); 
format = repmat('%q',[1 2]);
AA = textscan(fidneighb2,format,'Delimiter', '\t');
fclose(fidneighb2);
AAneighb2= [AA{:, 1} , AA{:, 2}];
    [r,c] = size(AAneighb2);                        %# Get the matrix size
diagVec1 = repmat([ones(c-1,1); 0],r,1);  %# Make the first diagonal vector
                                          %#   (for horizontal connections)
diagVec1 = diagVec1(1:end-1);             %# Remove the last value
diagVec2 = ones(c*(r-1),1);               %# Make the second diagonal vector
                                          %#   (for vertical connections)
adj = diag(diagVec1,1)+...                %# Add the diagonals to a zero matrix
      diag(diagVec2,c);
adj = adj+adj.';                      %'# Add the matrix to a transposed

https://drive.google.com/open?id=0B6u8fZadKIp2TFc1c1FmNnJ3TTA

0 个答案:

没有答案